Repository navigation
103 lines (87 loc) · 3.02 KB
/
Copy pathci.yml
File metadata and controls
103 lines (87 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
frontend:
name: Static frontend
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Validate pages and local assets
run: node scripts/validate-frontend.mjs
- name: Check JavaScript syntax
run: find frontend -type f -name '*.js' -print0 | xargs -0 -n1 node --check
- name: Reject tracked secrets and deployment outputs
shell: bash
run: |
prohibited=$(git ls-files | grep -E '(^|/)(\.env|\.deploy\.env|deploy-output\.json|deploy-mainnet-output\.json)$' || true)
if [ -n "$prohibited" ]; then
echo "Sensitive or generated deployment files are tracked:"
echo "$prohibited"
exit 1
fi
contracts:
name: Soroban contracts
if: hashFiles('contracts/**') != ''
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check if contracts exist
id: check_contracts
shell: bash
run: |
if [ -d "contracts" ] && [ -f "contracts/Cargo.toml" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Soroban contracts moved to dedicated repo; skipping contracts gate."
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Install pinned Rust toolchain
if: steps.check_contracts.outputs.exists == 'true'
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.91.0
components: rustfmt, clippy
targets: wasm32v1-none
- name: Cache Cargo dependencies
if: steps.check_contracts.outputs.exists == 'true'
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: ${{ runner.os }}-cargo-${{ hashFiles('contracts/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Check formatting
if: steps.check_contracts.outputs.exists == 'true'
working-directory: contracts
run: cargo fmt --all -- --check
- name: Run Clippy
if: steps.check_contracts.outputs.exists == 'true'
working-directory: contracts
run: cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Run contract tests
if: steps.check_contracts.outputs.exists == 'true'
working-directory: contracts
run: cargo test --workspace --locked
- name: Build release WASM
if: steps.check_contracts.outputs.exists == 'true'
working-directory: contracts
run: cargo build --workspace --locked --release --target wasm32v1-none