Skip to content

Test

Test #1359

Workflow file for this run

name: Test
on:
workflow_dispatch:
inputs:
inplinuxx8664:
description: |
Build on Linux x86_64
required: false
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
inplinuxaarch64:
description: |
Build Linux aarch64
required: false
type: choice
options:
- 'yes'
- 'no'
default: 'no'
inpmacos:
description: |
Build macOS
required: false
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
inpwindows:
description: |
Build Windows
required: false
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
push:
branches: [ 'dev', 'main' ]
pull_request:
branches: [main, master, dev]
schedule:
- cron: '30 6 * * *'
env:
RUST_BACKTRACE: 1
jobs:
linux-build-x86_64:
if: ${{ github.event.inputs.inplinuxx8664 == '' || github.event.inputs.inplinuxx8664 == 'yes' }}
runs-on: ubuntu-latest
name: Linux build x86_64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Build rig
run: |
make linux-in-docker
- name: Upload build as artifact
uses: actions/upload-artifact@v4
if: success()
with:
name: rig-linux-x86_64
path: |
rig-*.tar.gz
r-rig_*_amd64.deb
r-rig-*.x86_64.rpm
linux-tests-x86_64-setup:
needs: linux-build-x86_64
runs-on: ubuntu-latest
name: Linux test setup x86_64
outputs:
containers: ${{ steps.matrix-setup-x86_64.outputs.containers }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up matrix of containers
id: matrix-setup-x86_64
run: |
containers=$(make print-linux-variants-json)
echo "containers=$containers" >> $GITHUB_OUTPUT
linux-tests-x86_64:
needs: linux-tests-x86_64-setup
strategy:
fail-fast: false
matrix:
container: ${{ fromJson(needs.linux-tests-x86_64-setup.outputs.containers) }}
runs-on: ubuntu-latest
name: ${{ matrix.container }} (x86_64)
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download build from artifacts
uses: actions/download-artifact@v4
with:
name: rig-linux-x86_64
path: .
- name: Uncompress rig build
run: |
mkdir build
tar xzf rig-*.tar.gz -C build
find build
- name: Test
run: |
make linux-test-${{ matrix.container }}
if ls tests/results | grep -q fail; then
echo Some tests failed;
exit 1;
fi
linux-build-aarch64:
if: ${{ github.event.inputs.inplinuxaarch64 == 'yes' }}
runs-on: [linux-arm64]
name: Linux build aaarch
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Build rig
run: |
make linux-in-docker
- name: Upload build as artifact
uses: actions/upload-artifact@v4
if: success()
with:
name: rig-linux-aarch64
path: |
rig-*.tar.gz
r-rig_*_arm64.deb
r-rig-*.aarch64.rpm
linux-tests-aarch64-setup:
needs: linux-build-aarch64
runs-on: ubuntu-latest
name: Linux test setup aarch64
outputs:
containers: ${{ steps.matrix-setup-aarch64.outputs.containers }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up matrix of containers
id: matrix-setup-aarch64
run: |
containers=$(make print-linux-variants-json)
echo "containers=$containers" >> $GITHUB_OUTPUT
linux-tests-aarch64:
needs: linux-tests-aarch64-setup
strategy:
fail-fast: false
matrix:
container: ${{ fromJson(needs.linux-tests-aarch64-setup.outputs.containers) }}
runs-on: ubuntu-latest
name: ${{ matrix.container }} (aarch64)
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Checkout
uses: actions/checkout@v4
- name: Download build from artifacts
uses: actions/download-artifact@v4
with:
name: rig-linux-aarch64
path: .
- name: Uncompress rig build
run: |
mkdir build
tar xzf rig-*.tar.gz -C build
find build
- name: Test
run: |
make linux-test-${{ matrix.container }}
if ls tests/results | grep -q fail; then
echo Some tests failed;
exit 1;
fi
env:
DOCKER_DEFAULT_PLATFORM: "linux/arm64"
macos:
if: ${{ github.event.inputs.inpmacos == '' || github.event.inputs.inpmacos == 'yes' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }}
env:
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
config:
- { os: macos-12 }
- { os: macos-13 }
- { os: macos-14 }
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Install rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rust.sh
sh rust.sh -y
- name: Build rig
run: |
cargo build --release
- name: Install rig
run: |
sudo cp target/release/rig /usr/local/bin/
- name: Install bats
run: |
brew unlink bats || true
brew install bats-core
- name: Run tests
run: |
bats tests/test-macos.sh
windows:
if: ${{ github.event.inputs.inpwindows == '' || github.event.inputs.inpwindows == 'yes' }}
runs-on: windows-latest
name: Windows
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Install rust
uses: dtolnay/rust-toolchain@stable
- name: Install make
run: choco install make
- name: Install curl
run: choco install curl
- run: |
make win
shell: bash
- uses: actions/upload-artifact@v4
if: success()
with:
name: rig-windows
path: 'rig-*.exe'
- name: Install rig
run: |
Start-Process .\rig-*.exe -ArgumentList "/verysilent /suppressmsgboxes" -Wait -NoNewWindow
- name: Install bats
run: |
npm install -g bats
- name: Run tests
run: |
bats tests/test-windows.sh
shell: bash