mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-21 03:15:28 -05:00
fix(ci): cleanup build matrix, ensure build fails cause job to fail
This commit is contained in:
parent
262033702e
commit
b40ef1918d
1 changed files with 43 additions and 49 deletions
92
.github/workflows/build-release-binaries.yml
vendored
92
.github/workflows/build-release-binaries.yml
vendored
|
|
@ -19,50 +19,40 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# which binaries we want to build
|
target:
|
||||||
bin: [swap, asb, asb-controller, orchestrator]
|
- target: x86_64-unknown-linux-gnu
|
||||||
# which target to build from which host and the archive we use
|
host: ubuntu-22.04
|
||||||
include:
|
archive_extension: tar
|
||||||
- {
|
do_smoke_test: true
|
||||||
target: x86_64-unknown-linux-gnu,
|
- target: aarch64-apple-darwin
|
||||||
host: ubuntu-22.04,
|
host: macos-latest
|
||||||
archive_extension: tar,
|
archive_extension: tar
|
||||||
do_smoke_test: true,
|
do_smoke_test: true
|
||||||
}
|
- target: x86_64-apple-darwin
|
||||||
- {
|
host: macos-13
|
||||||
target: aarch64-apple-darwin,
|
archive_extension: tar
|
||||||
host: macos-latest,
|
do_smoke_test: true
|
||||||
archive_extension: tar,
|
# Once Windows works again, uncomment
|
||||||
do_smoke_test: true,
|
# - target: x86_64-pc-windows-gnu
|
||||||
}
|
# host: ubuntu-22.04
|
||||||
- {
|
# archive_extension: zip
|
||||||
target: x86_64-apple-darwin,
|
# do_smoke_test: false
|
||||||
host: macos-13,
|
|
||||||
archive_extension: tar,
|
bin:
|
||||||
do_smoke_test: true,
|
- name: swap
|
||||||
}
|
|
||||||
#- {
|
|
||||||
# target: x86_64-pc-windows-gnu,
|
|
||||||
# host: ubuntu-22.04,
|
|
||||||
# archive_extension: zip,
|
|
||||||
# # Skip smoke test - cross-compiled Windows .exe cannot run on Linux build host
|
|
||||||
# do_smoke_test: false,
|
|
||||||
# }
|
|
||||||
# Binary-specific smoke test configuration
|
|
||||||
- bin: swap
|
|
||||||
smoke_test_args: "--help"
|
smoke_test_args: "--help"
|
||||||
smoke_test_fake_interactive: false
|
smoke_test_fake_interactive: false
|
||||||
- bin: asb
|
- name: asb
|
||||||
smoke_test_args: "--help"
|
smoke_test_args: "--help"
|
||||||
smoke_test_fake_interactive: false
|
smoke_test_fake_interactive: false
|
||||||
- bin: asb-controller
|
- name: asb-controller
|
||||||
smoke_test_args: ""
|
smoke_test_args: ""
|
||||||
smoke_test_fake_interactive: false
|
smoke_test_fake_interactive: false
|
||||||
- bin: orchestrator
|
- name: orchestrator
|
||||||
smoke_test_args: ""
|
smoke_test_args: ""
|
||||||
smoke_test_fake_interactive: true
|
smoke_test_fake_interactive: true
|
||||||
|
|
||||||
runs-on: ${{ matrix.host }}
|
runs-on: ${{ matrix.target.host }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
@ -70,27 +60,31 @@ jobs:
|
||||||
- name: Setup build environment (cli tools, dependencies)
|
- name: Setup build environment (cli tools, dependencies)
|
||||||
uses: ./.github/actions/setup-build-environment
|
uses: ./.github/actions/setup-build-environment
|
||||||
with:
|
with:
|
||||||
host: ${{ matrix.host }}
|
host: ${{ matrix.target.host }}
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target.target }}
|
||||||
|
|
||||||
- name: Build ${{ matrix.bin }} in release mode
|
- name: Build ${{ matrix.bin.name }} in release mode
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
BIN_PATH="$(
|
BIN_PATH="$(
|
||||||
cargo build --bin ${{ matrix.bin }} --target ${{ matrix.target }} --release -q --message-format=json \
|
cargo build --bin "${{ matrix.bin.name }}" --target "${{ matrix.target.target }}" --release -q --message-format=json \
|
||||||
| jq -r "select(.reason == \"compiler-artifact\" and .executable != null) | .executable"
|
| jq -re 'select(.reason=="compiler-artifact" and .executable!=null) | .executable' \
|
||||||
|
| tail -n1
|
||||||
)"
|
)"
|
||||||
echo "BIN_PATH=$BIN_PATH" >> $GITHUB_ENV
|
# Ensure we actually found a path (nice error if not)
|
||||||
|
[[ -n "$BIN_PATH" ]] || { echo "Failed to extract executable path from cargo output"; exit 1; }
|
||||||
|
echo "BIN_PATH=$BIN_PATH" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Smoke test the binary
|
- name: Smoke test the binary
|
||||||
if: matrix.do_smoke_test
|
if: ${{ matrix.target.do_smoke_test }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ matrix.smoke_test_fake_interactive }}" == "true" ]]; then
|
if [[ "${{ matrix.bin.smoke_test_fake_interactive }}" == "true" ]]; then
|
||||||
# Use script to provide pseudo-terminal for interactive binaries
|
# Use script to provide pseudo-terminal for interactive binaries
|
||||||
timeout 3s bash -c '0<&- script -qefc "${{ env.BIN_PATH }}" /dev/null | cat' || true
|
timeout 3s bash -c '0<&- script -qefc "${{ env.BIN_PATH }}" /dev/null | cat' || true
|
||||||
elif [[ -n "${{ matrix.smoke_test_args }}" ]]; then
|
elif [[ -n "${{ matrix.bin.smoke_test_args }}" ]]; then
|
||||||
# Run with arguments
|
# Run with arguments
|
||||||
${{ env.BIN_PATH }} ${{ matrix.smoke_test_args }}
|
${{ env.BIN_PATH }} ${{ matrix.bin.smoke_test_args }}
|
||||||
else
|
else
|
||||||
# Run without arguments with timeout for binaries that don't support --help
|
# Run without arguments with timeout for binaries that don't support --help
|
||||||
timeout 3s ${{ env.BIN_PATH }} || true
|
timeout 3s ${{ env.BIN_PATH }} || true
|
||||||
|
|
@ -106,22 +100,22 @@ jobs:
|
||||||
|
|
||||||
arch = os_info.machine
|
arch = os_info.machine
|
||||||
|
|
||||||
triple = "${{ matrix.target }}".split("-")
|
triple = "${{ matrix.target.target }}".split("-")
|
||||||
arch = triple[0]
|
arch = triple[0]
|
||||||
|
|
||||||
archive_name=f'${{ matrix.bin }}_${{ github.event.release.tag_name || format('pull_request_{0}', github.event.pull_request.number) }}_{os_info.system}_{arch}.${{ matrix.archive_extension }}'
|
archive_name=f'${{ matrix.bin.name }}_${{ github.event.release.tag_name || format('pull_request_{0}', github.event.pull_request.number) }}_{os_info.system}_{arch}.${{ matrix.target.archive_extension }}'
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as output_file:
|
with open(os.environ['GITHUB_OUTPUT'], 'a') as output_file:
|
||||||
output_file.write(f'archive={archive_name}\n')
|
output_file.write(f'archive={archive_name}\n')
|
||||||
|
|
||||||
- name: Pack Linux/Mac binary (tar)
|
- name: Pack Linux/Mac binary (tar)
|
||||||
if: matrix.archive_extension == 'tar'
|
if: ${{ matrix.target.archive_extension == 'tar' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tar -cf ${{ steps.create-archive-name.outputs.archive }} -C $(dirname ${{ env.BIN_PATH }}) $(basename ${{ env.BIN_PATH }})
|
tar -cf ${{ steps.create-archive-name.outputs.archive }} -C $(dirname ${{ env.BIN_PATH }}) $(basename ${{ env.BIN_PATH }})
|
||||||
|
|
||||||
- name: Pack Windows binary (zip)
|
- name: Pack Windows binary (zip)
|
||||||
if: matrix.archive_extension == 'zip'
|
if: ${{ matrix.target.archive_extension == 'zip' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
zip ${{ steps.create-archive-name.outputs.archive }} -j ${{ env.BIN_PATH }}
|
zip ${{ steps.create-archive-name.outputs.archive }} -j ${{ env.BIN_PATH }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue