Skip to content

Commit eaf6937

Browse files
committed
ci: simplify matrix a bit
1 parent 7c7bcf1 commit eaf6937

File tree

1 file changed

+60
-87
lines changed

1 file changed

+60
-87
lines changed

.github/workflows/build.yml

Lines changed: 60 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -16,124 +16,97 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19+
target:
20+
- x86_64-unknown-linux-gnu
21+
- x86_64-unknown-linux-musl
22+
- i686-unknown-linux-gnu
23+
- i686-unknown-linux-musl
24+
- aarch64-unknown-linux-gnu
25+
- aarch64-unknown-linux-musl
26+
- x86_64-pc-windows-gnu
27+
- x86_64-pc-windows-msvc
28+
- i686-pc-windows-msvc
29+
- aarch64-pc-windows-msvc
30+
- x86_64-apple-darwin
31+
- aarch64-apple-darwin
1932
include:
20-
- name: linux-x64-glibc
33+
- target: x86_64-unknown-linux-gnu
2134
os: ubuntu-latest
22-
target: x86_64-unknown-linux-gnu
23-
publish_npm: true
24-
publish_pypi: true
25-
- name: linux-x64-musl
35+
publish-npm: true
36+
publish-pypi: true
37+
- target: x86_64-unknown-linux-musl
2638
os: ubuntu-latest
27-
target: x86_64-unknown-linux-musl
28-
publish_npm: false
29-
publish_pypi: true
30-
install_musl: true
31-
- name: linux-x86-glibc
39+
publish-pypi: true
40+
- target: i686-unknown-linux-gnu
3241
os: ubuntu-latest
33-
target: i686-unknown-linux-gnu
34-
publish_npm: false
35-
publish_pypi: false
36-
install_32_bit_tools: true
37-
- name: linux-x86-musl
42+
- target: i686-unknown-linux-musl
3843
os: ubuntu-latest
39-
target: i686-unknown-linux-musl
40-
publish_npm: false
41-
publish_pypi: true
42-
install_musl: true
43-
install_32_bit_tools: true
44-
install_clang: true
45-
extra_cmd: |
46-
# https://github.com/briansmith/ring/blob/77f7d2045f19ab8bd1d9efa4c741d40c64518bcc/mk/cargo.sh#L124
47-
export CARGO_TARGET_I686_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"
48-
# https://github.com/briansmith/ring/blob/77f7d2045f19ab8bd1d9efa4c741d40c64518bcc/mk/cargo.sh#L288
49-
export CC_i686_unknown_linux_musl="clang-19"
50-
export AR_i686_unknown_linux_musl="llvm-ar-19"
51-
- name: linux-arm64-glibc
44+
publish-pypi: true
45+
- target: aarch64-unknown-linux-gnu
5246
os: ubuntu-24.04-arm
53-
target: aarch64-unknown-linux-gnu
54-
publish_npm: true
55-
publish_pypi: true
56-
- name: linux-arm64-musl
47+
publish-npm: true
48+
publish-pypi: true
49+
- target: aarch64-unknown-linux-musl
5750
os: ubuntu-24.04-arm
58-
target: aarch64-unknown-linux-musl
59-
publish_npm: false
60-
publish_pypi: true
61-
install_musl: true
62-
- name: win32-x64-mingw
51+
publish-pypi: true
52+
- target: x86_64-pc-windows-gnu
6353
os: windows-latest
64-
target: x86_64-pc-windows-gnu
65-
publish_npm: false
66-
publish_pypi: false
67-
- name: win32-x64-msvc
54+
publish-npm: false
55+
publish-pypi: false
56+
- target: x86_64-pc-windows-msvc
6857
os: windows-latest
69-
target: x86_64-pc-windows-msvc
70-
publish_npm: true
71-
publish_pypi: true
72-
- name: win32-x86-msvc
58+
publish-npm: true
59+
publish-pypi: true
60+
- target: i686-pc-windows-msvc
7361
os: windows-latest
74-
target: i686-pc-windows-msvc
75-
publish_npm: false
76-
publish_pypi: true
77-
- name: win32-arm64-msvc
62+
publish-pypi: true
63+
- target: aarch64-pc-windows-msvc
7864
os: windows-11-arm
79-
target: aarch64-pc-windows-msvc
80-
publish_npm: true
81-
publish_pypi: false
82-
- name: darwin-x64
65+
publish-npm: true
66+
- target: x86_64-apple-darwin
8367
os: macos-13
84-
target: x86_64-apple-darwin
85-
publish_npm: true
86-
publish_pypi: true
87-
- name: darwin-arm64
68+
publish-npm: true
69+
publish-pypi: true
70+
- target: aarch64-apple-darwin
8871
os: macos-latest
89-
target: aarch64-apple-darwin
90-
publish_npm: true
91-
publish_pypi: true
72+
publish-npm: true
73+
publish-pypi: true
9274
steps:
9375
- name: Checkout
9476
uses: actions/checkout@v4
9577
- name: Set the release version
9678
shell: bash
9779
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
80+
- name: Update apt
81+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
82+
run: sudo apt-get update
9883
- name: Install Musl tools
99-
if: matrix.install_musl
100-
shell: bash
101-
run: |
102-
sudo apt-get update
103-
sudo apt-get install -y --no-install-recommends --allow-unauthenticated \
104-
musl-tools
84+
if: endsWith(matrix.target, 'musl')
85+
run: sudo apt-get install -yq --no-install-recommends --allow-unauthenticated musl-tools
10586
- name: Install 32-bit tools
106-
if: matrix.install_32_bit_tools
107-
# TODO work out which of these are actually needed
108-
# https://stackoverflow.com/questions/53496847/rust-compile-x86-library-on-x86-64-machine
109-
# https://stackoverflow.com/questions/22355436/how-to-compile-32-bit-apps-on-64-bit-ubuntu
110-
# CoPilot added libc6-dev-i386, so I'm not sure if it's needed
111-
run: |
112-
sudo apt-get update
113-
sudo apt-get install -y --no-install-recommends --allow-unauthenticated \
114-
gcc-multilib g++-multilib libc6-dev-i386
87+
if: startsWith(matrix.target, 'i686-unknown-linux-')
88+
run: sudo apt-get install -yq --no-install-recommends --allow-unauthenticated gcc-multilib
11589
- name: Install Clang
116-
if: matrix.install_clang
90+
if: matrix.target == 'i686-unknown-linux-musl'
11791
run: |
118-
sudo apt-get update
119-
sudo apt-get install -y --no-install-recommends --allow-unauthenticated \
120-
clang-19 llvm-19
92+
sudo apt-get install -yq --no-install-recommends --allow-unauthenticated clang-19 llvm-19
93+
echo "CARGO_TARGET_I686_UNKNOWN_LINUX_MUSL_RUSTFLAG=-Clink-self-contained=yes -Clinker=rust-lld" >> $GITHUB_ENV
94+
echo "CC_i686_unknown_linux_musl=clang-19" >> $GITHUB_ENV
95+
echo "AR_i686_unknown_linux_musl=llvm-ar-19" >> $GITHUB_ENV
12196
- name: Install Rust toolchain
12297
uses: dtolnay/rust-toolchain@master
12398
with:
12499
toolchain: stable
125100
targets: ${{ matrix.target }}
126101
- name: Build
127-
run: |
128-
${{ matrix.extra_cmd || '' }}
129-
cargo build --release --locked --target ${{ matrix.target }}
102+
run: cargo build --release --locked --target ${{ matrix.target }}
130103
- name: Prepare release assets
131104
shell: bash
132105
run: |
133106
mkdir -p release/{man,completions}
134107
cp {LICENSE-MIT,LICENSE-APACHE,README.md,CHANGELOG.md} release/
135-
OUT_DIR=release/completions/ cargo run --release --bin git-cliff-completions
136-
OUT_DIR=release/man/ cargo run --release --bin git-cliff-mangen
108+
OUT_DIR=release/completions/ cargo run --release --bin git-cliff-completions --target ${{ matrix.target }}
109+
OUT_DIR=release/man/ cargo run --release --bin git-cliff-mangen --target ${{ matrix.target }}
137110
for bin in 'git-cliff' 'git-cliff-completions' 'git-cliff-mangen'; do
138111
if [ "${{ contains(matrix.os, 'windows') }}" = "true" ]; then
139112
bin="${bin}.exe"
@@ -155,7 +128,7 @@ jobs:
155128
> git-cliff-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz.sha512
156129
fi
157130
- name: Build Python wheels (linux)
158-
if: matrix.publish_pypi && startsWith(matrix.name, 'linux')
131+
if: matrix.publish-pypi && startsWith(matrix.os, 'ubuntu-')
159132
uses: PyO3/maturin-action@v1
160133
with:
161134
working-directory: pypi
@@ -165,15 +138,15 @@ jobs:
165138
# https://github.com/PyO3/maturin-action/issues/245
166139
manylinux: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && '2_28' || 'auto' }}
167140
- name: Build Python wheels (macos & windows)
168-
if: matrix.publish_pypi && (contains(matrix.os, 'macos') || contains(matrix.os, 'windows'))
141+
if: matrix.publish-pypi && (startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows'))
169142
uses: PyO3/maturin-action@v1
170143
with:
171144
working-directory: pypi
172145
target: ${{ matrix.target }}
173146
args: --release --sdist --out wheels
174147
sccache: "true"
175148
- name: Build Python wheels (musl)
176-
if: matrix.publish_pypi && matrix.install_musl
149+
if: matrix.publish-pypi && endsWith(matrix.target, 'musl')
177150
uses: PyO3/maturin-action@v1
178151
with:
179152
working-directory: pypi

0 commit comments

Comments
 (0)