-
Notifications
You must be signed in to change notification settings - Fork 78
121 lines (103 loc) · 3.18 KB
/
main.yml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Main
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CACHE: true
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
any: ${{ steps.changes.outputs.any }}
programs: ${{ steps.changes.outputs.programs }}
program_matrix: ${{ steps.program_matrix.outputs.matrix }}
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV
- name: Detect changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: .github/file-filters.yml
- name: Filter program matrix
id: program_matrix
uses: metaplex-foundation/actions/filter-matrix@v1
with:
matrix: ${{ env.PROGRAMS }}
changes: ${{ steps.changes.outputs.changes }}
suffix: _program
build_programs:
name: Programs
if: ${{ needs.changes.outputs.any == 'true' }}
needs: changes
uses: ./.github/workflows/build-programs.yml
secrets: inherit
test_programs:
name: Programs
if: ${{ needs.changes.outputs.programs == 'true' }}
needs: changes
uses: ./.github/workflows/test-programs.yml
secrets: inherit
with:
program_matrix: ${{ needs.changes.outputs.program_matrix }}
generate_clients:
name: Generate clients
if: ${{ needs.changes.outputs.any == 'true' }}
needs: build_programs
runs-on: ubuntu-latest
outputs:
js_changed: ${{ steps.changes.outputs.js_client }}
rust_changed: ${{ steps.changes.outputs.rust_client }}
permissions:
contents: write
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.SVC_TOKEN }}
- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV
- name: Install Node.js
uses: metaplex-foundation/actions/install-node-with-pnpm@v1
with:
version: ${{ env.NODE_VERSION }}
cache: ${{ env.CACHE }}
dependencies: true
- name: Cache IDL generators
if: env.CACHE == 'true'
uses: metaplex-foundation/actions/cache-idl-generators@v1
- name: Generate IDLs and clients
run: pnpm generate
- name: Commit generated clients
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update generated clients
- name: Detect client changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: .github/file-filters.yml
test_js_client:
if: needs.generate_clients.outputs.js_changed == 'true'
name: JS Client
needs: generate_clients
uses: ./.github/workflows/test-js-client.yml
secrets: inherit
build_rust_client:
if: needs.generate_clients.outputs.rust_changed == 'true'
name: Rust Client
needs: generate_clients
uses: ./.github/workflows/build-rust-client.yml
secrets: inherit
test_rust_client:
if: needs.generate_clients.outputs.rust_changed == 'true'
name: Rust Client
needs: generate_clients
uses: ./.github/workflows/test-rust-client.yml
secrets: inherit