4545 uses : docker/setup-buildx-action@v2
4646 - name : Build xtask
4747 run : cargo build -p xtask
48+
4849 - name : Prepare Meta
4950 id : prepare-meta
5051 timeout-minutes : 60
@@ -53,14 +54,75 @@ jobs:
5354 TARGET : ${{ matrix.target }}
5455 SUB : ${{ matrix.sub }}
5556 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+
5667 - name : Build Docker image
5768 id : build-docker-image
5869 if : steps.prepare-meta.outputs.has-image
5970 timeout-minutes : 120
60- run : cargo xtask build-docker-image --no-cache --no-output -v "${TARGET}${SUB:+.$SUB}" --tag weekly
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}"
61122 env :
62123 TARGET : ${{ matrix.target }}
63124 SUB : ${{ matrix.sub }}
125+ LABELS : ${{ steps.docker-meta.outputs.labels }}
64126 shell : bash
65127 wiki :
66128 name : Ensure wiki is valid
0 commit comments