Test #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Syntax reference: | |
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions | |
name: Test | |
permissions: read-all | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize] | |
schedule: | |
# runs once a week: https://crontab.guru/#0_12_*_*_1 | |
- cron: '0 12 * * 1' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ matrix.container }} | |
strategy: | |
matrix: | |
# this CI testing can't test the different kernel versions that these distributions use, | |
# but this is better than nothing | |
container: ['ubuntu:24.04', 'debian:12-slim', 'fedora:40'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install dependencies | |
env: | |
CONTAINER: ${{ matrix.container }} | |
run: | | |
case "$CONTAINER" in | |
ubuntu*|debian* ) | |
apt-get update | |
DEBIAN_FRONTEND=noninteractive apt-get install -y curl clang | |
;; | |
fedora* ) | |
dnf install -y util-linux curl clang | |
;; | |
* ) | |
echo "Container $CONTAINER not handled" | |
exit 1 | |
;; | |
esac | |
- name: Add user | |
run: | | |
useradd --create-home user | |
chown -R user:user . | |
- name: Container info | |
shell: su --shell /bin/bash user -- -eo pipefail {0} | |
run: | | |
pwd | |
id -u | |
- name: Install rust | |
shell: su --shell /bin/bash user -- -eo pipefail {0} | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal | |
- name: Build | |
shell: su --shell /bin/bash user -- -eo pipefail {0} | |
run: | | |
. "$HOME/.cargo/env" | |
cargo build | |
- name: Test | |
shell: su --shell /bin/bash user -- -eo pipefail {0} | |
run: | | |
. "$HOME/.cargo/env" | |
RUST_BACKTRACE=1 cargo test | |
macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Build | |
shell: bash -eo pipefail {0} | |
run: | | |
cargo build | |
- name: Test | |
shell: bash -eo pipefail {0} | |
run: | | |
RUST_BACKTRACE=1 cargo test |