Skip to content

Commit d92e563

Browse files
Merge #1008
1008: convert and improve matrix generation with a xtask script r=Alexhuszagh a=Emilgardis Allows for more fine grained try control ``` > bors try --target x86_64*linux* --cpp false >> Building x86_64-unknown-linux-musl ``` ``` OPTIONS: --cpp <CPP> [possible values: true, false] --dylib <DYLIB> [possible values: true, false] -h, --help Print help information -r, --runners <RUNNERS>... --run <RUN> [possible values: true, false] --std <STD> [possible values: true, false] -t, --target <TARGET>... ``` Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
2 parents a80399e + bd1f939 commit d92e563

File tree

10 files changed

+834
-259
lines changed

10 files changed

+834
-259
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -100,118 +100,14 @@ jobs:
100100
outputs:
101101
matrix: ${{ steps.generate-matrix.outputs.matrix }}
102102
steps:
103+
- uses: actions/checkout@v3
104+
- uses: ./.github/actions/setup-rust
103105
- name: Generate matrix
104106
id: generate-matrix
105-
run: |
106-
if [[ -z "${commit_message}" ]]; then
107-
bors_args=()
108-
else
109-
bors_args="$(echo "${commit_message}" | sed -E 's/^Try #[0-9]+:\s+//')"
110-
declare -a "bors_args=(${bors_args})"
111-
fi
112-
113-
targets=()
114-
index=0
115-
while [[ "${bors_args[$index]-}" == --target ]]; do
116-
index=$(expr $index + 1)
117-
targets+=("${bors_args[$index]}")
118-
index=$(expr $index + 1)
119-
done
120-
121-
selects=()
122-
for target in "${targets[@]}"; do
123-
base=$(echo "${target}" | cut -d '.' -f 1)
124-
sub=$(echo "${target}" | cut -d '.' -sf 2)
125-
selects+=("select(.target | test(\"${base}\")) and if \"${sub}\" != \"\" then .sub == \"${sub}\" else .sub == null end")
126-
done
127-
query=$(printf " or %s" "${selects[@]}")
128-
query="${query:4}"
129-
130-
if [[ "${#targets[@]}" != "0" ]]; then
131-
echo "Only running targets matching '${targets[@]}'."
132-
matrix=$(
133-
yq --output-format json <<< "${matrix}" | jq '[.[] | select('"${query}"')]'
134-
)
135-
else
136-
echo 'Running all targets.'
137-
matrix="$(yq --output-format json <<< "${matrix}")"
138-
fi
139-
140-
jq -C '[.[] | . += {"pretty": ([.target] + [select(.sub != null).sub]) | join(":")}]' <<< "${matrix}"
141-
142-
echo "::set-output name=matrix::$(jq -c '[.[] | . += {"pretty": ([.target] + [select(.sub != null).sub]) | join(":")}]' <<< "${matrix}")"
107+
run: cargo xtask ci-job target-matrix
143108
env:
144-
commit_message: >
145-
${{
146-
((
147-
startsWith(github.event.head_commit.message, 'Try #') &&
148-
github.event.head_commit.author.username == 'bors[bot]'
149-
) && github.event.head_commit.message) || ''
150-
}}
151-
matrix: |
152-
- { target: x86_64-apple-darwin, os: macos-12, deploy: true }
153-
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system, deploy: true }
154-
- { target: x86_64-unknown-linux-musl, os: ubuntu-latest, std: 1, run: 1, deploy: true }
155-
- { target: x86_64-pc-windows-msvc, os: windows-2019, deploy: true }
156-
157-
- { target: x86_64-unknown-linux-gnu, sub: centos, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system }
158-
- { target: aarch64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
159-
- { target: arm-unknown-linux-gnueabi, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
160-
- { target: arm-unknown-linux-gnueabihf, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
161-
- { target: armv7-unknown-linux-gnueabi, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user }
162-
- { target: armv7-unknown-linux-gnueabihf, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
163-
- { target: thumbv7neon-unknown-linux-gnueabihf, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
164-
- { target: i586-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
165-
- { target: i686-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system }
166-
- { target: mips-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user }
167-
- { target: mipsel-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
168-
- { target: mips64-unknown-linux-gnuabi64, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
169-
- { target: mips64el-unknown-linux-gnuabi64, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
170-
- { target: mips64-unknown-linux-muslabi64, os: ubuntu-latest, cpp:1, dylib: 1, std: 1, run: 1, runners: qemu-user }
171-
- { target: mips64el-unknown-linux-muslabi64, os: ubuntu-latest, std: 1, run: 1 }
172-
- { target: powerpc-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
173-
- { target: powerpc64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
174-
- { target: powerpc64le-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
175-
- { target: riscv64gc-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, std: 1, run: 1, runners: qemu-user qemu-system }
176-
- { target: s390x-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
177-
- { target: sparc64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
178-
- { target: aarch64-unknown-linux-musl, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
179-
- { target: arm-unknown-linux-musleabihf, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
180-
- { target: arm-unknown-linux-musleabi, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
181-
- { target: armv5te-unknown-linux-gnueabi, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
182-
- { target: armv5te-unknown-linux-musleabi, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
183-
- { target: armv7-unknown-linux-musleabi, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
184-
- { target: armv7-unknown-linux-musleabihf, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
185-
- { target: i586-unknown-linux-musl, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user }
186-
- { target: i686-unknown-linux-musl, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user }
187-
- { target: mips-unknown-linux-musl, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
188-
- { target: mipsel-unknown-linux-musl, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 }
189-
- { target: aarch64-linux-android, os: ubuntu-latest, cpp: 1, std: 1, run: 1, runners: qemu-user }
190-
- { target: arm-linux-androideabi, os: ubuntu-latest, cpp: 1, std: 1, run: 1, runners: qemu-user }
191-
- { target: armv7-linux-androideabi, os: ubuntu-latest, cpp: 1, std: 1, run: 1, runners: qemu-user }
192-
- { target: thumbv7neon-linux-androideabi, os: ubuntu-latest, cpp: 1, std: 1, run: 1, runners: qemu-user }
193-
- { target: i686-linux-android, os: ubuntu-latest, cpp: 1, std: 1, run: 1, runners: qemu-user }
194-
- { target: x86_64-linux-android, os: ubuntu-latest, cpp: 1, std: 1, run: 1, runners: qemu-user }
195-
- { target: x86_64-pc-windows-gnu, os: ubuntu-latest, cpp: 1, std: 1, run: 1 }
196-
- { target: i686-pc-windows-gnu, os: ubuntu-latest, cpp: 1, std: 1, run: 1 }
197-
# Disabled for now, see https://github.com/rust-lang/rust/issues/98216
198-
#-{ target: asmjs-unknown-emscripten, os: ubuntu-latest, cpp: 1, std: 1, run: 1 }
199-
- { target: wasm32-unknown-emscripten, os: ubuntu-latest, cpp: 1, std: 1, run: 1 }
200-
- { target: x86_64-unknown-dragonfly, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, build-std: 1 }
201-
- { target: i686-unknown-freebsd, os: ubuntu-latest, dylib: 1, std: 1 }
202-
- { target: x86_64-unknown-freebsd, os: ubuntu-latest, dylib: 1, std: 1 }
203-
- { target: x86_64-unknown-netbsd, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 }
204-
- { target: sparcv9-sun-solaris, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 }
205-
- { target: x86_64-sun-solaris, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 }
206-
- { target: x86_64-unknown-illumos, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 }
207-
- { target: thumbv6m-none-eabi, os: ubuntu-latest, std: 1 }
208-
- { target: thumbv7em-none-eabi, os: ubuntu-latest, std: 1 }
209-
- { target: thumbv7em-none-eabihf, os: ubuntu-latest, std: 1 }
210-
- { target: thumbv7m-none-eabi, os: ubuntu-latest, std: 1 }
211-
- { target: cross, os: ubuntu-latest }
212-
- { target: zig, os: ubuntu-latest }
213-
- { target: aarch64-unknown-linux-gnu, sub: centos, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system }
214-
109+
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
110+
COMMIT_AUTHOR: ${{ github.event.head_commit.author.username }}
215111

216112
build:
217113
name: target (${{ matrix.pretty }},${{ matrix.os }})

Cargo.lock

Lines changed: 8 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)