|
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
8 | 8 |
|
9 | | -jobs: |
10 | | - format_and_lint_interface: |
11 | | - name: Format & Lint Interface |
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 interface:format |
25 | | - |
26 | | - - name: Lint |
27 | | - run: pnpm interface:lint |
28 | | - |
29 | | - format_and_lint_programs: |
30 | | - name: Format & Lint Programs |
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 Programs |
43 | | - run: pnpm programs:format |
44 | | - |
45 | | - - name: Lint Programs |
46 | | - run: pnpm programs:lint |
47 | | - |
48 | | - audit_rust: |
49 | | - name: Audit Rust |
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 | | - cargo-cache-key: cargo-audit |
| 9 | +env: |
| 10 | + SBPF_PROGRAM_PACKAGES: "['program']" |
| 11 | + RUST_PACKAGES: "['interface', 'program']" |
| 12 | + WASM_PACKAGES: "['interface', 'program']" |
59 | 13 |
|
60 | | - - name: Install cargo-audit |
61 | | - uses: taiki-e/install-action@v2 |
62 | | - with: |
63 | | - tool: cargo-audit |
64 | | - |
65 | | - - name: Run cargo-audit |
66 | | - run: pnpm rust:audit |
67 | | - |
68 | | - spellcheck_rust: |
69 | | - name: Spellcheck Rust |
70 | | - runs-on: ubuntu-latest |
71 | | - steps: |
72 | | - - name: Git Checkout |
73 | | - uses: actions/checkout@v4 |
74 | | - |
75 | | - - name: Setup Environment |
76 | | - uses: ./.github/actions/setup |
77 | | - with: |
78 | | - cargo-cache-key: cargo-spellcheck |
79 | | - |
80 | | - - name: Install cargo-spellcheck |
81 | | - uses: taiki-e/install-action@v2 |
82 | | - with: |
83 | | - tool: cargo-spellcheck |
84 | | - |
85 | | - - name: Run cargo-spellcheck |
86 | | - run: pnpm rust:spellcheck |
87 | | - |
88 | | - build_programs: |
89 | | - name: Build programs |
90 | | - runs-on: ubuntu-latest |
91 | | - needs: format_and_lint_programs |
92 | | - steps: |
93 | | - - name: Git Checkout |
94 | | - uses: actions/checkout@v4 |
95 | | - |
96 | | - - name: Setup Environment |
97 | | - uses: ./.github/actions/setup |
98 | | - with: |
99 | | - cargo-cache-key: cargo-programs |
100 | | - solana: true |
101 | | - |
102 | | - - name: Build Programs |
103 | | - run: pnpm programs:build |
104 | | - |
105 | | - - name: Upload Program Builds |
106 | | - uses: actions/upload-artifact@v4 |
107 | | - with: |
108 | | - name: program-builds |
109 | | - path: ./target/deploy/*.so |
110 | | - if-no-files-found: error |
111 | | - |
112 | | - - name: Save Program Builds For Client Jobs |
113 | | - uses: actions/cache/save@v4 |
114 | | - with: |
115 | | - path: ./**/*.so |
116 | | - key: ${{ runner.os }}-builds-${{ github.sha }} |
117 | | - |
118 | | - test_programs: |
119 | | - name: Test Programs |
| 14 | +jobs: |
| 15 | + set_env: |
| 16 | + name: Set variables to be used in strategy definitions in reusable workflow |
120 | 17 | runs-on: ubuntu-latest |
121 | | - needs: format_and_lint_programs |
| 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 }} |
122 | 24 | steps: |
123 | 25 | - name: Git Checkout |
124 | 26 | uses: actions/checkout@v4 |
125 | 27 |
|
126 | | - - name: Setup Environment |
127 | | - uses: ./.github/actions/setup |
128 | | - with: |
129 | | - cargo-cache-key: cargo-program-tests |
130 | | - cargo-cache-fallback-key: cargo-programs |
131 | | - solana: true |
132 | | - |
133 | | - - name: Test Programs |
134 | | - run: pnpm programs:test |
| 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