Skip to content

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

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

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

Workflow file for this run

name: test
on:
pull_request:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
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
- os: macos-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose --all-targets --target=${{ matrix.target }}
# https://github.com/vercel/turbo/blob/ea934d13038361c24a1f71cad3b490d6c0936f37/.github/workflows/turborepo-release.yml#L268-L272
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
path: target/${{ matrix.target }}/
retention-days: 1
choco-test:
runs-on: windows-latest
needs: build
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
# TODO: This will be a problem when we want to set musl as the default toolchain
targets: aarch64-pc-windows-msvc
- uses: actions/download-artifact@v3
with:
name: pacaptr-test-${{ runner.os }}-${{ runner.arch }}
path: target/
- name: Inspect downloaded artifacts
shell: bash
run: ls -laR target
- name: Test build for aarch64
run: cargo build --verbose --release --locked --target=aarch64-pc-windows-msvc
- name: Build
run: cargo build --verbose
- name: Run unit tests
run: cargo test --features=test tests
- name: Run smoke tests
run: cargo test --features=test choco -- --test-threads=1
- name: Run heavy tests
run: cargo test --features=test choco -- --ignored --test-threads=1
# TODO: Restore those.
# scoop-winget-test:
# runs-on: windows-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - 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
# run: cargo build --verbose
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: |
# cargo test --features=test scoop
# cargo test --features=test winget
# - name: Run heavy tests
# run: |
# cargo test --features=test scoop -- --ignored
# cargo test --features=test winget -- --ignored
# brew-test:
# runs-on: macos-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# with:
# targets: aarch64-apple-darwin
# - uses: Swatinem/rust-cache@v2
# - name: Test build for aarch64
# run: cargo build --verbose --release --locked --target=aarch64-apple-darwin
# - name: Test native build
# run: cargo build --verbose
# # - run: brew list
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: cargo test --features=test brew
# - name: Run heavy tests
# run: cargo test --features=test brew -- --ignored
# port-test:
# runs-on: macos-latest
# needs: skip-check
# 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: 1arp/[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
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Build
# run: cargo build --verbose
# - run: port installed
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: cargo test --features=test port
# - name: Run heavy tests
# run: cargo test --features=test port -- --ignored
# apt-test:
# runs-on: ubuntu-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# env:
# # 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
# steps:
# - uses: actions/checkout@v3
# - name: Setup extra build tools
# run: |
# sudo apt-get update
# sudo apt-get install -y gcc-aarch64-linux-gnu
# - uses: dtolnay/rust-toolchain@stable
# with:
# targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl
# - uses: Swatinem/rust-cache@v2
# - name: Test build for aarch64 musl
# run: cargo build --verbose --release --locked --target=aarch64-unknown-linux-musl
# - name: Test build for x86_64 musl
# run: cargo build --verbose --release --locked --target=x86_64-unknown-linux-musl
# - name: Test native build
# run: cargo build --verbose
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: cargo test --features=test apt
# - name: Run heavy tests
# run: cargo test --features=test apt -- --ignored
# dnf-test:
# runs-on: ubuntu-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# container:
# image: fedora:latest
# steps:
# - uses: actions/checkout@v3
# - run: dnf install -y make automake gcc gcc-c++ kernel-devel
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Build
# run: cargo build --verbose
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: cargo test --features=test dnf
# - name: Run heavy tests
# run: cargo test --features=test dnf -- --ignored
# emerge-test:
# runs-on: ubuntu-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# container:
# image: gentoo/stage3
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# # `pacaptr -Ss` might fail without this line.
# - run: emerge --sync || true
# - name: Build
# run: cargo build --verbose
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: cargo test --features=test emerge
# - name: Run heavy tests
# run: cargo test --features=test emerge -- --ignored
# xbps-test:
# runs-on: ubuntu-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# container:
# image: voidlinux/voidlinux:latest
# steps:
# - name: Install required packages
# run: |
# xbps-install -y -Su || (xbps-install -y -u xbps && xbps-install -y -Su)
# xbps-install -y base-devel curl bash
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Build
# run: cargo build --verbose
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: cargo test --features=test xbps
# - name: Run heavy tests
# run: cargo test --features=test xbps -- --ignored
# zypper-test:
# runs-on: ubuntu-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# container:
# image: opensuse/leap:latest
# steps:
# - run: zypper install -y tar gzip curl gcc bash
# - uses: actions/checkout@v3
# # uses: dtolnay/rust-toolchain@stable
# - name: Set up Rust environment manually
# run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# - uses: Swatinem/rust-cache@v2
# - name: Build
# run: $HOME/.cargo/bin/cargo build --verbose
# - name: Run unit tests
# run: $HOME/.cargo/bin/cargo test --features=test tests
# - name: Run smoke tests
# run: $HOME/.cargo/bin/cargo test --features=test zypper -- --test-threads=1
# - name: Run heavy tests
# run: $HOME/.cargo/bin/cargo test --features=test zypper -- --ignored --test-threads=1
# apk-test:
# runs-on: ubuntu-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# container:
# image: rust:alpine
# env:
# RUSTFLAGS: "-C target-feature=-crt-static"
# steps:
# - uses: actions/checkout@v3
# - run: apk add -U build-base tar bash
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Build
# run: cargo build --verbose
# - name: Run unit tests
# run: cargo test --features=test tests
# - name: Run smoke tests
# run: cargo test --features=test apk
# - name: Run heavy tests
# run: cargo test --features=test apk -- --ignored
# pkcon-pip-conda-test:
# runs-on: ubuntu-latest
# needs: skip-check
# if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - run: |
# sudo apt update
# sudo apt install -y packagekit packagekit-tools
# - name: Build
# run: cargo build --verbose
# - name: Run smoke tests
# run: |
# cargo test --features=test pkcon
# cargo test --features=test pip
# cargo test --features=test conda
# - name: Run heavy tests
# run: |
# cargo test --features=test pkcon -- --ignored
# cargo test --features=test pip -- --ignored
# cargo test --features=test conda -- --ignored