Skip to content

Commit 8ce888d

Browse files
committed
cd: support more targets
Signed-off-by: azjezz <[email protected]>
1 parent 6d42654 commit 8ce888d

File tree

1 file changed

+26
-33
lines changed

1 file changed

+26
-33
lines changed

.github/workflows/cd.yml

+26-33
Original file line numberDiff line numberDiff line change
@@ -62,35 +62,30 @@ jobs:
6262
# Windows ( MinGW )
6363
- { target: x86_64-pc-windows-gnu, os: windows-2019 }
6464
# Windows ( MSVC )
65-
- { target: i686-pc-windows-msvc, os: windows-2019 }
66-
- { target: x86_64-pc-windows-msvc, os: windows-2019 }
65+
- { target: i686-pc-windows-msvc, os: windows-2019, test: true }
66+
- { target: x86_64-pc-windows-msvc, os: windows-2019, test: true }
6767
# macOS
68-
- { target: aarch64-apple-darwin, os: macos-15 }
69-
- { target: x86_64-apple-darwin, os: macos-15 }
70-
# *BSD
68+
- { target: aarch64-apple-darwin, os: macos-15, test: true }
69+
- { target: x86_64-apple-darwin, os: macos-15, test: true }
70+
# FreeBSD
7171
- { target: i686-unknown-freebsd, os: ubuntu-20.04 }
7272
- { target: x86_64-unknown-freebsd, os: ubuntu-20.04 }
73-
- { target: x86_64-unknown-netbsd, os: ubuntu-20.04 }
7473
# Linux
75-
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04 }
74+
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, test: true }
7675
- { target: arm-unknown-linux-gnueabi, os: ubuntu-20.04 }
7776
- { target: arm-unknown-linux-gnueabihf, os: ubuntu-20.04 }
7877
- { target: armv7-unknown-linux-gnueabihf, os: ubuntu-20.04 }
7978
- { target: arm-unknown-linux-musleabi, os: ubuntu-20.04 }
8079
- { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04 }
8180
- { target: armv7-unknown-linux-musleabihf, os: ubuntu-20.04 }
82-
- { target: i686-unknown-linux-gnu, os: ubuntu-20.04 }
83-
- { target: i686-unknown-linux-musl, os: ubuntu-20.04 }
84-
- { target: mips-unknown-linux-gnu, os: ubuntu-20.04, nightly: true }
85-
- { target: mips64-unknown-linux-gnuabi64, os: ubuntu-20.04, nightly: true }
86-
- { target: mipsel-unknown-linux-gnu, os: ubuntu-20.04, nightly: true }
87-
- { target: mips64el-unknown-linux-gnuabi64, os: ubuntu-20.04, nightly: true }
81+
- { target: i686-unknown-linux-gnu, os: ubuntu-20.04, test: true }
82+
- { target: i686-unknown-linux-musl, os: ubuntu-20.04, test: true }
8883
- { target: powerpc-unknown-linux-gnu, os: ubuntu-20.04 }
8984
- { target: powerpc64-unknown-linux-gnu, os: ubuntu-20.04 }
9085
- { target: powerpc64le-unknown-linux-gnu, os: ubuntu-20.04 }
9186
- { target: s390x-unknown-linux-gnu, os: ubuntu-20.04 }
92-
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
93-
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04 }
87+
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, test: true }
88+
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, test: true }
9489

9590
env:
9691
BUILD_CMD: cargo
@@ -99,12 +94,10 @@ jobs:
9994
- name: checkout source code
10095
uses: actions/checkout@v4
10196

102-
- name: Determine tag version
97+
- name: set version env variable
10398
id: version
10499
shell: bash
105-
run: |
106-
CLEAN_TAG=${GITHUB_REF_NAME#v}
107-
echo "CLEAN_TAG=$CLEAN_TAG" >> $GITHUB_OUTPUT
100+
run: echo "VERSION=${{ needs.crate_metadata.outputs.version }}" >> $GITHUB_OUTPUT
108101

109102
- name: install prerequisites
110103
shell: bash
@@ -117,9 +110,8 @@ jobs:
117110
- name: install Rust toolchain
118111
uses: dtolnay/rust-toolchain@stable
119112
with:
120-
toolchain: ${{ matrix.job.nightly == 'true' && 'nightly' || 'stable' }}
113+
toolchain: ${{ needs.crate_metadata.outputs.msrv }}
121114
targets: ${{ matrix.job.target }}
122-
override: true
123115

124116
- name: install cross
125117
if: startsWith(matrix.job.os, 'ubuntu')
@@ -163,6 +155,7 @@ jobs:
163155
echo "BIN_NAME=${BIN_NAME}" >> $GITHUB_OUTPUT
164156
165157
- name: run tests
158+
if: matrix.job.test
166159
shell: bash
167160
run: $BUILD_CMD test --workspace --locked --target=${{ matrix.job.target }}
168161

@@ -182,18 +175,18 @@ jobs:
182175
id: package
183176
shell: bash
184177
run: |
185-
CLEAN_TAG="${{ steps.version.outputs.CLEAN_TAG }}"
178+
VERSION="${{ steps.version.outputs.VERSION }}"
186179
TARGET="${{ matrix.job.target }}"
187180
PKG_SUFFIX=".tar.gz"
188181
case "$TARGET" in
189182
*-pc-windows-msvc) PKG_SUFFIX=".zip" ;;
190183
esac
191184
192-
PKG_NAME="mago-${CLEAN_TAG}-${TARGET}${PKG_SUFFIX}"
185+
PKG_NAME="mago-${VERSION}-${TARGET}${PKG_SUFFIX}"
193186
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT
194187
195188
PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package"
196-
ARCHIVE_DIR="${PKG_STAGING}/mago-${CLEAN_TAG}-${TARGET}/"
189+
ARCHIVE_DIR="${PKG_STAGING}/mago-${VERSION}-${TARGET}/"
197190
mkdir -p "${ARCHIVE_DIR}"
198191
199192
# Binary
@@ -205,10 +198,10 @@ jobs:
205198
pushd "${PKG_STAGING}/" >/dev/null
206199
case "$PKG_SUFFIX" in
207200
.zip)
208-
7z -y a "${PKG_NAME}" "mago-${CLEAN_TAG}-${TARGET}/*"
201+
7z -y a "${PKG_NAME}" "mago-${VERSION}-${TARGET}/*"
209202
;;
210203
.tar.gz)
211-
tar czf "${PKG_NAME}" "mago-${CLEAN_TAG}-${TARGET}"/*
204+
tar czf "${PKG_NAME}" "mago-${VERSION}-${TARGET}"/*
212205
;;
213206
esac
214207
popd >/dev/null
@@ -220,9 +213,9 @@ jobs:
220213
if: matrix.job.target == 'x86_64-unknown-linux-gnu'
221214
shell: bash
222215
run: |
223-
CLEAN_TAG="${{ steps.version.outputs.CLEAN_TAG }}"
224-
# Since WASM is universal, just name it 'mago-{CLEAN_TAG}-wasm.tar.gz'
225-
WASM_PKG_NAME="mago-${CLEAN_TAG}-wasm.tar.gz"
216+
VERSION="${{ steps.version.outputs.VERSION }}"
217+
# Since WASM is universal, just name it 'mago-{VERSION}-wasm.tar.gz'
218+
WASM_PKG_NAME="mago-${VERSION}-wasm.tar.gz"
226219
echo "WASM_PKG_NAME=${WASM_PKG_NAME}" >> $GITHUB_OUTPUT
227220
228221
WASM_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/wasm"
@@ -235,9 +228,9 @@ jobs:
235228
- name: create Debian package
236229
id: debian-package
237230
shell: bash
238-
if: startsWith(matrix.job.os, 'ubuntu') && !endsWith(matrix.job.target, 'bsd')
231+
if: startsWith(matrix.job.os, 'ubuntu') && !endsWith(matrix.job.target, 'freebsd')
239232
run: |
240-
CLEAN_TAG="${{ steps.version.outputs.CLEAN_TAG }}"
233+
VERSION="${{ steps.version.outputs.VERSION }}"
241234
TARGET="${{ matrix.job.target }}"
242235
243236
# Derive arch from target:
@@ -252,7 +245,7 @@ jobs:
252245
*s390x*) DPKG_ARCH="s390x" ;;
253246
esac
254247
255-
DPKG_NAME="mago-${CLEAN_TAG}-${TARGET}.deb"
248+
DPKG_NAME="mago-${VERSION}-${TARGET}.deb"
256249
257250
echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT
258251
@@ -269,7 +262,7 @@ jobs:
269262
mkdir -p "${DPKG_DIR}/DEBIAN"
270263
cat > "${DPKG_DIR}/DEBIAN/control" <<EOF
271264
Package: mago
272-
Version: ${CLEAN_TAG}
265+
Version: ${VERSION}
273266
Section: devel
274267
Priority: optional
275268
Maintainer: ${{ needs.crate_metadata.outputs.maintainer }}

0 commit comments

Comments
 (0)