Skip to content

ci(test): migrate to two-stage smoke tests #1994

ci(test): migrate to two-stage smoke tests

ci(test): migrate to two-stage smoke tests #1994

Workflow file for this run

name: test
on:
pull_request:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
# https://users.rust-lang.org/t/cross-compiling-how-to-statically-link-glibc/83907/2
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
jobs:
skip-check:
continue-on-error: false
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
concurrent_skipping: same_content
do_not_skip: '["pull_request"]'
build:
name: Build test binaries for ${{ matrix.target }}
needs: skip-check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
target2: aarch64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
target2: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
target2: aarch64-unknown-linux-musl
steps:
- uses: actions/checkout@v3
- name: Setup extra build tools
if: matrix.target2 == 'aarch64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- id: cache_build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
- name: Setup Rust
if: ${{ !steps.cache_build.outputs.cache-hit }}
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }},${{ matrix.target2 }}
- name: Build
if: ${{ !steps.cache_build.outputs.cache-hit }}
run: |
cargo build --verbose --all-targets --target=${{ matrix.target }}
cargo build --verbose --release --locked --target=${{ matrix.target2 }}
choco-test:
runs-on: windows-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test choco -- --test-threads=1
cargo test --features=test choco -- --ignored --test-threads=1
scoop-winget-test:
runs-on: windows-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Install scoop
shell: powershell
run: |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
iwr -useb 'https://raw.githubusercontent.com/scoopinstaller/install/master/install.ps1' -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
(Resolve-Path ~\scoop\shims).Path >> $Env:GITHUB_PATH
- name: Verity scoop installation
run: |
Get-Command scoop
powershell scoop help
# Ironically, to install winget we need to install scoop first :D
# See: https://github.com/microsoft/winget-cli/issues/1328#issuecomment-1208640211
- name: Install winget
shell: powershell
run: scoop install winget
- name: Verity winget installation
run: |
Get-Command winget
winget --info
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test scoop
cargo test --features=test winget
cargo test --features=test scoop -- --ignored
cargo test --features=test winget -- --ignored
brew-test:
runs-on: macos-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-apple-darwin
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test brew
cargo test --features=test brew -- --ignored
port-test:
runs-on: macos-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Get OS build
run: |
sw_vers > macos_build.txt
cat macos_build.txt
# https://github.com/actions/cache/issues/629#issuecomment-1189184648
- name: Create gtar wrapper
uses: fertrig/[email protected]
with:
path: target
file: gtar
content: |
#!/bin/sh
exec sudo /usr/local/bin/gtar.orig "$@"
- name: Install gtar wrapper
run: |
sudo mv /usr/local/bin/gtar /usr/local/bin/gtar.orig
sudo mv target/gtar /usr/local/bin/gtar
sudo chmod +x /usr/local/bin/gtar
- name: Cache MacPorts
id: cache-macports
uses: actions/cache@v3
with:
path: /opt/local/
key: ${{ runner.os }}-macports-${{ hashFiles('macos_build.txt') }}
- name: Restore MacPorts PATH
if: steps.cache-macports.outputs.cache-hit == 'true'
run: echo "/opt/local/bin" >> "$GITHUB_PATH"
- name: Install MacPorts
if: steps.cache-macports.outputs.cache-hit != 'true'
run: |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
source ./macports-ci install
sudo port install wget
port installed
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-apple-darwin
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test port
cargo test --features=test port -- --ignored
apt-test:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test apt
cargo test --features=test apt -- --ignored
dnf-test:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
container:
image: fedora:latest
steps:
- uses: actions/checkout@v3
- name: Setup extra build tools
run: dnf install -y make automake gcc gcc-c++ kernel-devel
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test dnf
cargo test --features=test dnf -- --ignored
emerge-test:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
container:
image: gentoo/stage3
steps:
- uses: actions/checkout@v3
- name: Setup extra build tools
run: |
# `pacaptr -Ss` might fail without this line.
emerge --sync || true
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test emerge
cargo test --features=test emerge -- --ignored
xbps-test:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
container:
image: voidlinux/voidlinux:latest
steps:
- uses: actions/checkout@v3
- name: Setup extra build tools
run: |
xbps-install -y -Su || (xbps-install -y -u xbps && xbps-install -y -Su)
xbps-install -y base-devel curl bash
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test xbps
cargo test --features=test xbps -- --ignored
zypper-test:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
container:
image: registry.opensuse.org/opensuse/bci/rust:latest
steps:
- uses: actions/checkout@v3
- name: Setup extra build tools
run: zypper install -y tar gzip curl gcc bash
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test zypper -- --test-threads=1
cargo test --features=test zypper -- --ignored --test-threads=1
apk-test:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
container:
image: rust:alpine
steps:
- uses: actions/checkout@v3
- name: Setup extra build tools
run: |
apk add -U build-base tar bash
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Build and run tests
env:
RUSTFLAGS: "-C target-feature=-crt-static"
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: |
cargo build --verbose
cargo test --features=test tests
cargo test --features=test apk
cargo test --features=test apk -- --ignored
pkcon-pip-conda-test:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Setup extra build tools
run: |
sudo apt-get update
sudo apt-get install -y packagekit packagekit-tools gcc-aarch64-linux-gnu
- name: Download cached build
uses: Swatinem/rust-cache@v2
with:
shared-key: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
save-if: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Build and run tests
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: |
cargo build --verbose
cargo test --features=test pkcon
cargo test --features=test pip
cargo test --features=test conda
cargo test --features=test pkcon -- --ignored
cargo test --features=test pip -- --ignored
cargo test --features=test conda -- --ignored