Skip to content

Commit 2f7573e

Browse files
authored
CI: Move whole repo to a Makefile (#101)
* CI: Move whole repo to a Makefile #### Problem The Makefile model works, but this repo is still using the package.json scripts. #### Summary of changes Similar to most other repos: * remove old scripts / workflows / setup action / package.json * update tracing-subscriber for audit failure * add Makefile * Review feedback * Remove unused toolchain / cli versions
1 parent 8ba9e84 commit 2f7573e

27 files changed

+341
-1003
lines changed

.github/actions/setup/action.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 38 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -6,174 +6,42 @@ on:
66
pull_request:
77
branches: [main]
88

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 Programs
24-
run: pnpm programs:format
25-
26-
- name: Lint Programs
27-
run: pnpm programs:lint
28-
29-
format_and_lint_cli:
30-
name: Format & Lint CLI
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-
cli: true
42-
43-
- name: Format CLI
44-
run: pnpm clients:cli:format
45-
46-
- name: Lint CLI
47-
run: pnpm clients:cli:lint
48-
49-
audit_rust:
50-
name: Audit Rust
51-
runs-on: ubuntu-latest
52-
steps:
53-
- name: Git Checkout
54-
uses: actions/checkout@v4
55-
56-
- name: Setup Environment
57-
uses: ./.github/actions/setup
58-
with:
59-
cargo-cache-key: cargo-audit
60-
61-
- name: Install cargo-audit
62-
uses: taiki-e/install-action@v2
63-
with:
64-
tool: cargo-audit
65-
66-
- name: Run cargo-audit
67-
run: pnpm rust:audit
68-
69-
semver_rust:
70-
name: Check semver Rust
71-
runs-on: ubuntu-latest
72-
steps:
73-
- name: Git Checkout
74-
uses: actions/checkout@v4
75-
76-
- name: Setup Environment
77-
uses: ./.github/actions/setup
78-
with:
79-
cargo-cache-key: cargo-semver
80-
81-
- name: Install cargo-audit
82-
uses: taiki-e/install-action@v2
83-
with:
84-
tool: cargo-semver-checks
85-
86-
- name: Run semver checks
87-
run: pnpm rust:semver
9+
env:
10+
SBPF_PROGRAM_PACKAGES: "['program']"
11+
RUST_PACKAGES: "['clients-cli', 'program']"
12+
WASM_PACKAGES: "['program']"
8813

89-
spellcheck_rust:
90-
name: Spellcheck Rust
91-
runs-on: ubuntu-latest
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-spellcheck
100-
101-
- name: Install cargo-spellcheck
102-
uses: taiki-e/install-action@v2
103-
with:
104-
tool: cargo-spellcheck
105-
106-
- name: Run cargo-spellcheck
107-
run: pnpm rust:spellcheck
108-
109-
build_programs:
110-
name: Build programs
111-
runs-on: ubuntu-latest
112-
needs: format_and_lint_programs
113-
steps:
114-
- name: Git Checkout
115-
uses: actions/checkout@v4
116-
117-
- name: Setup Environment
118-
uses: ./.github/actions/setup
119-
with:
120-
cargo-cache-key: cargo-programs
121-
solana: true
122-
123-
- name: Build Programs
124-
run: pnpm programs:build
125-
126-
- name: Upload Program Builds
127-
uses: actions/upload-artifact@v4
128-
with:
129-
name: program-builds
130-
path: ./target/deploy/*.so
131-
if-no-files-found: error
132-
133-
- name: Save Program Builds For Client Jobs
134-
uses: actions/cache/save@v4
135-
with:
136-
path: ./**/*.so
137-
key: ${{ runner.os }}-builds-${{ github.sha }}
138-
139-
test_programs:
140-
name: Test Programs
141-
runs-on: ubuntu-latest
142-
needs: format_and_lint_programs
143-
steps:
144-
- name: Git Checkout
145-
uses: actions/checkout@v4
146-
147-
- name: Setup Environment
148-
uses: ./.github/actions/setup
149-
with:
150-
cargo-cache-key: cargo-program-tests
151-
cargo-cache-fallback-key: cargo-programs
152-
solana: true
153-
154-
- name: Test Programs
155-
run: pnpm programs:test
156-
157-
test_cli:
158-
name: Test CLI
159-
runs-on: ubuntu-latest
160-
needs: build_programs
161-
steps:
162-
- name: Git Checkout
163-
uses: actions/checkout@v4
164-
165-
- name: Setup Environment
166-
uses: ./.github/actions/setup
167-
with:
168-
cargo-cache-key: cargo-rust-client
169-
solana: true
170-
cli: true
171-
172-
- name: Restore Program Builds
173-
uses: actions/cache/restore@v4
174-
with:
175-
path: ./**/*.so
176-
key: ${{ runner.os }}-builds-${{ github.sha }}
177-
178-
- name: Test CLI
179-
run: pnpm clients:cli: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

Comments
 (0)