Skip to content

Commit f2983d2

Browse files
committed
Move repo to a Makefile
#### Problem Makefiles are great, but this repo is still on the package.json runner scripts. #### Summary of changes Migrate everything to a Makefile. This one is very straightforward, and in fact is the exact same diff as <solana-program/token-group#53>.
1 parent a861d85 commit f2983d2

28 files changed

+305
-1383
lines changed

.github/actions/setup/action.yml

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

.github/workflows/main.yml

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

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-
cargo-cache-key: cargo-interface-lint
23-
cargo-cache-fallback-key: cargo-interface
24-
25-
- name: Format
26-
run: pnpm interface:format
27-
28-
- name: Lint
29-
run: pnpm interface:lint
30-
31-
format_and_lint_programs:
32-
name: Format & Lint Programs
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Git Checkout
36-
uses: actions/checkout@v4
37-
38-
- name: Setup Environment
39-
uses: ./.github/actions/setup
40-
with:
41-
clippy: true
42-
rustfmt: true
43-
cli: true
44-
cargo-cache-key: cargo-programs-lint
45-
cargo-cache-fallback-key: cargo-programs
46-
47-
- name: Format
48-
run: pnpm programs:format
49-
50-
- name: Lint
51-
run: pnpm programs:lint
52-
53-
format_and_lint_client_js_legacy:
54-
name: Format & Lint Client JS Legacy
55-
runs-on: ubuntu-latest
56-
steps:
57-
- name: Git Checkout
58-
uses: actions/checkout@v4
59-
60-
- name: Setup Environment
61-
uses: ./.github/actions/setup
62-
63-
- name: Format Client JS Legacy
64-
run: pnpm clients:js-legacy:format
65-
66-
- name: Lint Client JS Legacy
67-
run: pnpm clients:js-legacy:lint
68-
69-
audit_rust:
70-
name: Audit 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-audit
80-
81-
- name: Install cargo-audit
82-
uses: taiki-e/install-action@v2
83-
with:
84-
tool: cargo-audit
85-
86-
- name: Run cargo-audit
87-
run: pnpm rust:audit
9+
env:
10+
JS_PACKAGES: "['clients-js-legacy']"
11+
SBPF_PROGRAM_PACKAGES: "['program']"
12+
RUST_PACKAGES: "['interface', 'program']"
13+
WASM_PACKAGES: "['interface']"
8814

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-
steps:
113-
- name: Git Checkout
114-
uses: actions/checkout@v4
115-
116-
- name: Setup Environment
117-
uses: ./.github/actions/setup
118-
with:
119-
solana: true
120-
cargo-cache-key: cargo-programs
121-
122-
- name: Build Program
123-
run: pnpm programs:build
124-
125-
- name: Upload Program Builds
126-
uses: actions/upload-artifact@v4
127-
with:
128-
name: program-builds
129-
path: ./target/deploy/*.so
130-
if-no-files-found: error
131-
132-
- name: Save Program Builds For Client Jobs
133-
uses: actions/cache/save@v4
134-
with:
135-
path: ./target/deploy/*.so
136-
key: ${{ runner.os }}-builds-${{ github.sha }}
137-
138-
test_interface:
139-
name: Test Interface
140-
runs-on: ubuntu-latest
141-
steps:
142-
- name: Git Checkout
143-
uses: actions/checkout@v4
144-
145-
- name: Setup Environment
146-
uses: ./.github/actions/setup
147-
with:
148-
cargo-cache-key: cargo-interface-tests
149-
cargo-cache-fallback-key: cargo-interface
150-
151-
- name: Test
152-
run: pnpm interface:test
153-
154-
test_programs:
155-
name: Test Programs
156-
runs-on: ubuntu-latest
157-
steps:
158-
- name: Git Checkout
159-
uses: actions/checkout@v4
160-
161-
- name: Setup Environment
162-
uses: ./.github/actions/setup
163-
with:
164-
cargo-cache-key: cargo-program-tests
165-
cargo-cache-fallback-key: cargo-programs
166-
solana: true
167-
cli: true
168-
169-
- name: Test Programs
170-
run: pnpm programs:test
171-
172-
test_client_js_legacy:
173-
name: Test Client JS Legacy
174-
runs-on: ubuntu-latest
175-
steps:
176-
- name: Git Checkout
177-
uses: actions/checkout@v4
178-
179-
- name: Setup Environment
180-
uses: ./.github/actions/setup
181-
with:
182-
solana: true
183-
184-
- name: Restore Program Builds
185-
uses: actions/cache/restore@v4
186-
with:
187-
path: ./target/deploy/*.so
188-
key: ${{ runner.os }}-builds-${{ github.sha }}
189-
190-
- name: Test Client JS Legacy
191-
run: pnpm clients:js-legacy:test
15+
jobs:
16+
set_env:
17+
name: Set variables to be used in strategy definitions in reusable workflow
18+
runs-on: ubuntu-latest
19+
outputs:
20+
JS_PACKAGES: ${{ steps.compute.outputs.JS_PACKAGES }}
21+
SBPF_PROGRAM_PACKAGES: ${{ steps.compute.outputs.SBPF_PROGRAM_PACKAGES }}
22+
RUST_PACKAGES: ${{ steps.compute.outputs.RUST_PACKAGES }}
23+
WASM_PACKAGES: ${{ steps.compute.outputs.WASM_PACKAGES }}
24+
RUST_TOOLCHAIN_NIGHTLY: ${{ steps.compute.outputs.RUST_TOOLCHAIN_NIGHTLY }}
25+
SOLANA_CLI_VERSION: ${{ steps.compute.outputs.SOLANA_CLI_VERSION }}
26+
steps:
27+
- name: Git Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Compute variables
31+
id: compute
32+
shell: bash
33+
run: |
34+
echo "JS_PACKAGES=${{ env.JS_PACKAGES }}" >> $GITHUB_OUTPUT
35+
echo "SBPF_PROGRAM_PACKAGES=${{ env.SBPF_PROGRAM_PACKAGES }}" >> $GITHUB_OUTPUT
36+
echo "RUST_PACKAGES=${{ env.RUST_PACKAGES }}" >> $GITHUB_OUTPUT
37+
echo "WASM_PACKAGES=${{ env.WASM_PACKAGES }}" >> $GITHUB_OUTPUT
38+
echo "RUST_TOOLCHAIN_NIGHTLY=$(make rust-toolchain-nightly)" >> "$GITHUB_OUTPUT"
39+
echo "SOLANA_CLI_VERSION=$(make solana-cli-version)" >> "$GITHUB_OUTPUT"
40+
41+
main:
42+
needs: set_env
43+
uses: solana-program/actions/.github/workflows/main.yml@main
44+
with:
45+
js-packages: ${{ needs.set_env.outputs.JS_PACKAGES }}
46+
sbpf-program-packages: ${{ needs.set_env.outputs.SBPF_PROGRAM_PACKAGES }}
47+
rust-packages: ${{ needs.set_env.outputs.RUST_PACKAGES }}
48+
wasm-packages: ${{ needs.set_env.outputs.WASM_PACKAGES }}
49+
rustfmt-toolchain: ${{ needs.set_env.outputs.RUST_TOOLCHAIN_NIGHTLY }}
50+
clippy-toolchain: ${{ needs.set_env.outputs.RUST_TOOLCHAIN_NIGHTLY }}
51+
solana-cli-version: ${{ needs.set_env.outputs.SOLANA_CLI_VERSION }}

0 commit comments

Comments
 (0)