@@ -2,104 +2,112 @@ name: CI
22
33on :
44 push :
5- branches : [ master ]
5+ branches : [master]
66 pull_request :
7- branches : [ master ]
7+ branches : [master]
88
9- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
109permissions :
1110 contents : read
12- pages : write
13- id-token : write
14-
15- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
16- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
17- concurrency :
18- group : " pages"
19- cancel-in-progress : false
2011
2112jobs :
2213 check-book :
2314 runs-on : ubuntu-latest
2415 steps :
2516 - name : Checkout
26- uses : actions/checkout@v4
17+ uses : actions/checkout@v7
2718
2819 - name : Setup just
2920 uses : extractions/setup-just@v3
3021
31- - name : Rust Cache
32- uses : Swatinem/rust-cache@v2.7.8
22+ - name : Cache Rust tools
23+ uses : Swatinem/rust-cache@v2.9.1
3324
34- - name : Check
25+ - name : Build book and check links
3526 run : just build
3627
37- - name : Upload built book
38- uses : actions/upload-artifact@v4
28+ - name : Upload Pages artifact
29+ if : github.event_name == 'push'
30+ uses : actions/upload-pages-artifact@v4
3931 with :
40- name : built-book
41- path : ./output/html
32+ path : output/html
4233
4334 check-rust :
4435 runs-on : ubuntu-latest
4536 steps :
4637 - name : Checkout
47- uses : actions/checkout@v4
38+ uses : actions/checkout@v7
4839
49- - name : Rust Cache
50- uses : Swatinem/rust-cache@v2.7.8
40+ - name : Cache Rust dependencies
41+ uses : Swatinem/rust-cache@v2.9.1
42+ with :
43+ workspaces : snippets/rust
5144
5245 - name : Check
5346 working-directory : snippets/rust
54- run : cargo build
47+ run : cargo check --all-targets
5548
5649 check-python :
5750 runs-on : ubuntu-latest
5851 steps :
5952 - name : Checkout
60- uses : actions/checkout@v4
53+ uses : actions/checkout@v7
6154
6255 - name : Setup Python
63- uses : actions/setup-python@v4
56+ uses : actions/setup-python@v6
6457 with :
65- python-version : " 3.12"
58+ python-version : ' 3.12'
59+ cache : pip
60+ cache-dependency-path : snippets/python/requirements.txt
6661
6762 - name : Check
6863 working-directory : snippets/python
6964 run : bash check.sh
7065
7166 check-js :
7267 runs-on : ubuntu-latest
68+ strategy :
69+ fail-fast : false
70+ matrix :
71+ runtime : [node, web, react-native]
7372 steps :
7473 - name : Checkout
75- uses : actions/checkout@v4
74+ uses : actions/checkout@v7
75+
76+ - name : Setup Node.js
77+ uses : actions/setup-node@v7
78+ with :
79+ node-version : ' 22'
80+
81+ - name : Install dependencies
82+ working-directory : snippets/js/${{ matrix.runtime }}
83+ run : npm install --legacy-peer-deps
7684
7785 - name : Check
78- working-directory : snippets/js
79- run : bash check.sh
86+ working-directory : snippets/js/${{ matrix.runtime }}
87+ run : npm run check
8088
8189 check-kotlin :
8290 runs-on : ubuntu-latest
8391 steps :
8492 - name : Checkout
85- uses : actions/checkout@v4
93+ uses : actions/checkout@v7
8694
87- # Required for kotlin snippets
88- - name : Set up Java 17
89- uses : actions/setup-java@v2
95+ - name : Setup Java 17
96+ uses : actions/setup-java@v5
9097 with :
91- distribution : " temurin"
92- java-version : 17
98+ distribution : temurin
99+ java-version : ' 17'
100+ cache : gradle
93101
94102 - name : Check
95103 working-directory : snippets/kotlin
96- run : ./gradlew build
104+ run : ./gradlew build --no-daemon
97105
98106 check-swift :
99107 runs-on : macos-latest
100108 steps :
101109 - name : Checkout
102- uses : actions/checkout@v4
110+ uses : actions/checkout@v7
103111
104112 - name : Check
105113 working-directory : snippets/swift
@@ -109,10 +117,10 @@ jobs:
109117 runs-on : ubuntu-latest
110118 steps :
111119 - name : Checkout
112- uses : actions/checkout@v4
120+ uses : actions/checkout@v7
113121
114- - name : Setup dotnet
115- uses : actions/setup-dotnet@v4
122+ - name : Setup .NET
123+ uses : actions/setup-dotnet@v6
116124 with :
117125 dotnet-version : ' 10.0.x'
118126
@@ -122,27 +130,26 @@ jobs:
122130
123131 deploy :
124132 name : Deploy book
125- needs : [check-book, check-rust, check-python, check-js, check-kotlin, check-swift, check-csharp]
126- if : github.ref == 'refs/heads/master'
133+ needs :
134+ - check-book
135+ - check-rust
136+ - check-python
137+ - check-js
138+ - check-kotlin
139+ - check-swift
140+ - check-csharp
141+ if : github.event_name == 'push' && github.ref == 'refs/heads/master'
142+ runs-on : ubuntu-latest
143+ permissions :
144+ pages : write
145+ id-token : write
146+ concurrency :
147+ group : pages
148+ cancel-in-progress : false
127149 environment :
128150 name : github-pages
129151 url : ${{ steps.deployment.outputs.page_url }}
130- runs-on : ubuntu-latest
131152 steps :
132- - name : Checkout
133- uses : actions/checkout@v4
134-
135- - name : Download built book
136- uses : actions/download-artifact@v4
137- with :
138- name : built-book
139- path : ./output/html
140-
141- - name : Upload pages artifact
142- uses : actions/upload-pages-artifact@v3
143- with :
144- path : ' ./output/html'
145-
146153 - name : Deploy to GitHub Pages
147154 id : deployment
148155 uses : actions/deploy-pages@v4
0 commit comments