11
11
12
12
13
13
jobs :
14
- build :
15
- name : Build
14
+ static-checks :
15
+ name : Static Checks
16
+ runs-on : ubuntu-latest
17
+ steps :
18
+ - name : Checkout whatwg/html-build
19
+ uses : actions/checkout@v3
20
+ - name : Install Rust toolchain
21
+ uses : actions-rs/toolchain@v1
22
+ with :
23
+ toolchain : stable
24
+ components : rustfmt, clippy
25
+ - name : Cache Cargo dependencies
26
+ uses : actions/cache@v3
27
+ with :
28
+ path : |
29
+ ~/.cargo/bin/
30
+ ~/.cargo/registry/index/
31
+ ~/.cargo/registry/cache/
32
+ ~/.cargo/git/db/
33
+ target/
34
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
35
+ - name : Check formatting
36
+ run : cargo fmt --check
37
+ - name : Run clippy
38
+ run : cargo clippy -- -D warnings
39
+ - name : Run tests
40
+ run : cargo test
41
+ - name : Shellcheck
42
+ run : |
43
+ shellcheck *.sh
44
+ shellcheck ci-build/*.sh
45
+
46
+ build-and-test-image :
47
+ name : Build and Test Image
16
48
runs-on : ubuntu-latest
17
- permissions :
18
- contents : read
19
- packages : write
20
49
steps :
21
50
- name : Checkout whatwg/html-build
22
51
uses : actions/checkout@v3
23
52
with :
24
53
fetch-depth : 0
25
- - name : Shellcheck
26
- run : |
27
- shellcheck *.sh
28
- shellcheck ci-build/*.sh
29
54
- name : Docker build
30
55
run : ci-build/docker-build.sh
31
56
- name : Checkout whatwg/html
@@ -38,15 +63,23 @@ jobs:
38
63
run : |
39
64
mkdir output
40
65
bash ci-build/docker-run.sh "$GITHUB_WORKSPACE/html" output
66
+
67
+ publish :
68
+ name : Publish
69
+ runs-on : ubuntu-latest
70
+ needs : [static-checks, build-and-test-image]
71
+ if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
72
+ permissions :
73
+ contents : read
74
+ packages : write
75
+ steps :
41
76
- name : Docker login
42
- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
43
77
uses : docker/login-action@v2
44
78
with :
45
79
registry : ${{ env.REGISTRY }}
46
80
username : ${{ github.actor }}
47
81
password : ${{ secrets.GITHUB_TOKEN }}
48
82
- name : Docker push
49
- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
50
83
run : |
51
84
docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:$GITHUB_SHA"
52
85
docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:latest"
0 commit comments