|
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
8 | 8 |
|
9 | | -jobs: |
10 | | - format_and_lint_programs: |
11 | | - name: Format & Lint Programs |
12 | | - runs-on: ubuntu-latest |
13 | | - steps: |
14 | | - - name: Git Checkout |
15 | | - uses: actions/checkout@v4 |
16 | | - |
17 | | - - name: Setup Environment |
18 | | - uses: ./.github/actions/setup |
19 | | - with: |
20 | | - clippy: true |
21 | | - rustfmt: true |
22 | | - |
23 | | - - name: Format |
24 | | - run: pnpm programs:format |
25 | | - |
26 | | - - name: Lint |
27 | | - run: pnpm programs:lint |
28 | | - |
29 | | - format_and_lint_interface: |
30 | | - name: Format & Lint Interface |
31 | | - runs-on: ubuntu-latest |
32 | | - steps: |
33 | | - - name: Git Checkout |
34 | | - uses: actions/checkout@v4 |
35 | | - |
36 | | - - name: Setup Environment |
37 | | - uses: ./.github/actions/setup |
38 | | - with: |
39 | | - clippy: true |
40 | | - rustfmt: true |
41 | | - |
42 | | - - name: Format |
43 | | - run: pnpm interface:format |
44 | | - |
45 | | - - name: Lint |
46 | | - run: pnpm interface:lint |
47 | | - |
48 | | - format_and_lint_test_harness: |
49 | | - name: Format & Lint Test Harness |
50 | | - runs-on: ubuntu-latest |
51 | | - steps: |
52 | | - - name: Git Checkout |
53 | | - uses: actions/checkout@v4 |
54 | | - |
55 | | - - name: Setup Environment |
56 | | - uses: ./.github/actions/setup |
57 | | - with: |
58 | | - clippy: true |
59 | | - rustfmt: true |
60 | | - |
61 | | - - name: Format |
62 | | - run: pnpm test-harness:format |
63 | | - |
64 | | - - name: Lint |
65 | | - run: pnpm test-harness:lint |
66 | | - |
67 | | - audit_rust: |
68 | | - name: Audit Rust |
69 | | - runs-on: ubuntu-latest |
70 | | - steps: |
71 | | - - name: Git Checkout |
72 | | - uses: actions/checkout@v4 |
73 | | - |
74 | | - - name: Setup Environment |
75 | | - uses: ./.github/actions/setup |
76 | | - with: |
77 | | - cargo-cache-key: cargo-audit |
78 | | - |
79 | | - - name: Install cargo-audit |
80 | | - uses: taiki-e/install-action@v2 |
81 | | - with: |
82 | | - tool: cargo-audit |
83 | | - |
84 | | - - name: Run cargo-audit |
85 | | - run: pnpm rust:audit |
| 9 | +env: |
| 10 | + SBPF_PROGRAM_PACKAGES: "['program']" |
| 11 | + RUST_PACKAGES: "['interface', 'program', 'test_harness']" |
| 12 | + WASM_PACKAGES: "['interface', 'program']" |
86 | 13 |
|
87 | | - spellcheck_rust: |
88 | | - name: Spellcheck Rust |
89 | | - runs-on: ubuntu-latest |
90 | | - steps: |
91 | | - - name: Git Checkout |
92 | | - uses: actions/checkout@v4 |
93 | | - |
94 | | - - name: Setup Environment |
95 | | - uses: ./.github/actions/setup |
96 | | - with: |
97 | | - cargo-cache-key: cargo-spellcheck |
98 | | - |
99 | | - - name: Install cargo-spellcheck |
100 | | - uses: taiki-e/install-action@v2 |
101 | | - with: |
102 | | - tool: cargo-spellcheck |
103 | | - |
104 | | - - name: Run cargo-spellcheck |
105 | | - run: pnpm rust:spellcheck |
106 | | - |
107 | | - build_programs: |
108 | | - name: Build programs |
109 | | - runs-on: ubuntu-latest |
110 | | - steps: |
111 | | - - name: Git Checkout |
112 | | - uses: actions/checkout@v4 |
113 | | - |
114 | | - - name: Setup Environment |
115 | | - uses: ./.github/actions/setup |
116 | | - with: |
117 | | - cargo-cache-key: cargo-programs |
118 | | - solana: true |
119 | | - |
120 | | - - name: Build Programs |
121 | | - run: pnpm programs:build |
122 | | - |
123 | | - - name: Upload Program Builds |
124 | | - uses: actions/upload-artifact@v4 |
125 | | - with: |
126 | | - name: program-builds |
127 | | - path: ./target/deploy/*.so |
128 | | - if-no-files-found: error |
129 | | - |
130 | | - - name: Save Program Builds For Client Jobs |
131 | | - uses: actions/cache/save@v4 |
132 | | - with: |
133 | | - path: ./**/*.so |
134 | | - key: ${{ runner.os }}-builds-${{ github.sha }} |
135 | | - |
136 | | - test_programs: |
137 | | - name: Test Programs |
138 | | - runs-on: ubuntu-latest |
139 | | - needs: build_programs |
140 | | - steps: |
141 | | - - name: Git Checkout |
142 | | - uses: actions/checkout@v4 |
143 | | - |
144 | | - - name: Setup Environment |
145 | | - uses: ./.github/actions/setup |
146 | | - with: |
147 | | - cargo-cache-key: cargo-program-tests |
148 | | - cargo-cache-fallback-key: cargo-programs |
149 | | - solana: true |
150 | | - |
151 | | - - name: Restore Program Builds |
152 | | - uses: actions/cache/restore@v4 |
153 | | - with: |
154 | | - path: ./**/*.so |
155 | | - key: ${{ runner.os }}-builds-${{ github.sha }} |
156 | | - |
157 | | - - name: Test Programs |
158 | | - run: pnpm programs:test |
159 | | - |
160 | | - test_interface: |
161 | | - name: Test Interface |
162 | | - runs-on: ubuntu-latest |
163 | | - steps: |
164 | | - - name: Git Checkout |
165 | | - uses: actions/checkout@v4 |
166 | | - |
167 | | - - name: Setup Environment |
168 | | - uses: ./.github/actions/setup |
169 | | - with: |
170 | | - cargo-cache-key: cargo-interface |
171 | | - |
172 | | - - name: Test |
173 | | - run: pnpm interface:test |
| 14 | +jobs: |
| 15 | + set_env: |
| 16 | + name: Set variables to be used in strategy definitions in reusable workflow |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + SBPF_PROGRAM_PACKAGES: ${{ steps.compute.outputs.SBPF_PROGRAM_PACKAGES }} |
| 20 | + RUST_PACKAGES: ${{ steps.compute.outputs.RUST_PACKAGES }} |
| 21 | + WASM_PACKAGES: ${{ steps.compute.outputs.WASM_PACKAGES }} |
| 22 | + RUST_TOOLCHAIN_NIGHTLY: ${{ steps.compute.outputs.RUST_TOOLCHAIN_NIGHTLY }} |
| 23 | + SOLANA_CLI_VERSION: ${{ steps.compute.outputs.SOLANA_CLI_VERSION }} |
| 24 | + steps: |
| 25 | + - name: Git Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Compute variables |
| 29 | + id: compute |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + echo "SBPF_PROGRAM_PACKAGES=${{ env.SBPF_PROGRAM_PACKAGES }}" >> $GITHUB_OUTPUT |
| 33 | + echo "RUST_PACKAGES=${{ env.RUST_PACKAGES }}" >> $GITHUB_OUTPUT |
| 34 | + echo "WASM_PACKAGES=${{ env.WASM_PACKAGES }}" >> $GITHUB_OUTPUT |
| 35 | + echo "RUST_TOOLCHAIN_NIGHTLY=$(make rust-toolchain-nightly)" >> "$GITHUB_OUTPUT" |
| 36 | + echo "SOLANA_CLI_VERSION=$(make solana-cli-version)" >> "$GITHUB_OUTPUT" |
| 37 | +
|
| 38 | + main: |
| 39 | + needs: set_env |
| 40 | + uses: solana-program/actions/.github/workflows/main.yml@main |
| 41 | + with: |
| 42 | + sbpf-program-packages: ${{ needs.set_env.outputs.SBPF_PROGRAM_PACKAGES }} |
| 43 | + rust-packages: ${{ needs.set_env.outputs.RUST_PACKAGES }} |
| 44 | + wasm-packages: ${{ needs.set_env.outputs.WASM_PACKAGES }} |
| 45 | + rustfmt-toolchain: ${{ needs.set_env.outputs.RUST_TOOLCHAIN_NIGHTLY }} |
| 46 | + clippy-toolchain: ${{ needs.set_env.outputs.RUST_TOOLCHAIN_NIGHTLY }} |
| 47 | + solana-cli-version: ${{ needs.set_env.outputs.SOLANA_CLI_VERSION }} |
0 commit comments