22 schedule :
33 - cron : ' 0 0 * * 5'
44 workflow_dispatch :
5+ inputs :
6+ targets :
7+ required : false
8+ description : ' check these space or comma separated targets, supports wildcard *'
59
610name : Check
711
@@ -10,21 +14,116 @@ env:
1014 CARGO_HTTP_CHECK_REVOKE : false
1115
1216jobs :
17+ generate-matrix :
18+ runs-on : ubuntu-latest
19+ outputs :
20+ matrix : ${{ steps.generate-matrix.outputs.matrix }}
21+ steps :
22+ - uses : actions/checkout@v3
23+ - uses : ./.github/actions/setup-rust
24+
25+ - name : Generate matrix
26+ id : generate-matrix
27+ run : |
28+ cargo xtask ci-job target-matrix --author "[gha]" --message "check" --weekly
29+ env :
30+ TARGETS : ${{ inputs.targets }}
1331 weekly :
14- name : Check All Targets - No Cache
32+ name : Check target - No Cache (${{ matrix.pretty }},${{ matrix.os }})
1533 timeout-minutes : 1440
16- runs-on : ubuntu-latest
34+ runs-on : ${{ matrix.os }}
35+ needs : generate-matrix
36+ strategy :
37+ fail-fast : false
38+ matrix :
39+ include : ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
1740 steps :
1841 - uses : actions/checkout@v3
1942 - uses : ./.github/actions/setup-rust
2043 - name : Set up Docker Buildx
44+ if : runner.os == 'Linux'
2145 uses : docker/setup-buildx-action@v2
2246 - name : Build xtask
2347 run : cargo build -p xtask
48+
49+ - name : Prepare Meta
50+ id : prepare-meta
51+ timeout-minutes : 60
52+ run : cargo xtask ci-job prepare-meta "${TARGET}${SUB:+.$SUB}"
53+ env :
54+ TARGET : ${{ matrix.target }}
55+ SUB : ${{ matrix.sub }}
56+ shell : bash
57+ - name : Docker Meta
58+ if : steps.prepare-meta.outputs.has-image
59+ id : docker-meta
60+ uses : docker/metadata-action@v4
61+ with :
62+ images : |
63+ name=${{ steps.prepare-meta.outputs.image }}
64+ labels : |
65+ ${{ fromJSON(steps.prepare-meta.outputs.labels) }}
66+
2467 - name : Build Docker image
2568 id : build-docker-image
26- run : cargo xtask build-docker-image -v --no-cache --no-output --from-ci --no-fastfail --tag weekly
27- timeout-minutes : 1440
69+ if : steps.prepare-meta.outputs.has-image
70+ timeout-minutes : 120
71+ run : cargo xtask build-docker-image --no-cache -v "${TARGET}${SUB:+.$SUB}"
72+ env :
73+ TARGET : ${{ matrix.target }}
74+ SUB : ${{ matrix.sub }}
75+ shell : bash
76+ - name : Set Docker image for test
77+ if : steps.prepare-meta.outputs.has-image
78+ run : |
79+ TARGET_VAR="cross_target_${TARGET//-/_}_image"
80+ echo "${TARGET_VAR^^}=${IMAGE}" | tee -a "${GITHUB_ENV}"
81+ env :
82+ TARGET : ${{ matrix.target }}
83+ IMAGE : ${{ steps.build-docker-image.outputs.image }}
84+ shell : bash
85+ - name : Test Image
86+ if : steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'default'
87+ run : ./ci/test.sh
88+ env :
89+ TARGET : ${{ matrix.target }}
90+ CPP : ${{ matrix.cpp }}
91+ DYLIB : ${{ matrix.dylib }}
92+ STD : ${{ matrix.std }}
93+ BUILD_STD : ${{ matrix.build-std }}
94+ RUN : ${{ matrix.run }}
95+ RUNNERS : ${{ matrix.runners }}
96+ shell : bash
97+
98+ - name : Test Zig Image
99+ if : steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'zig'
100+ run : ./ci/test-zig-image.sh
101+ shell : bash
102+
103+ - name : Test Cross Image
104+ if : steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'cross'
105+ run : ./ci/test-cross-image.sh
106+ env :
107+ TARGET : ' aarch64-unknown-linux-gnu'
108+ IMAGE : ' ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main'
109+ shell : bash
110+
111+ - name : Login to GitHub Container Registry
112+ if : steps.prepare-meta.outputs.has-image && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
113+ uses : docker/login-action@v1
114+ with :
115+ registry : ghcr.io
116+ username : ${{ github.actor }}
117+ password : ${{ secrets.GITHUB_TOKEN }}
118+
119+ - name : Push
120+ if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
121+ run : cargo xtask build-docker-image -v --push "${TARGET}${SUB:+.$SUB}"
122+ env :
123+ TARGET : ${{ matrix.target }}
124+ SUB : ${{ matrix.sub }}
125+ LABELS : ${{ steps.docker-meta.outputs.labels }}
126+ shell : bash
28127 wiki :
29128 name : Ensure wiki is valid
30129 runs-on : ubuntu-latest
0 commit comments