Skip to content

Commit

Permalink
test action
Browse files Browse the repository at this point in the history
  • Loading branch information
xml committed Apr 10, 2024
1 parent cc2cdc5 commit e2463e2
Showing 1 changed file with 61 additions and 7 deletions.
68 changes: 61 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,67 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:

build_job:
# The host should always be linux
runs-on: ubuntu-latest
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}

# Run steps on a matrix of 4 arch/distro combinations
strategy:
matrix:
include:
- arch: aarch64
distro: bullseye
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2
name: Build result
id: build
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}

# Not required, but speeds up builds
githubToken: ${{ github.token }}

# Create an result directory
setup: |
mkdir -p "${PWD}/result"
# Mount the result directory as /result in the container
dockerRunArgs: |
--volume "${PWD}/result:/result"
# Pass some environment variables to the container
env: | # YAML, but pipe character is necessary
result_name: system-monitor-${{ matrix.distro }}_${{ matrix.arch }}
# The shell to run commands with in the container
shell: /bin/sh

# Install some dependencies in the container. This speeds up builds if
# you are also using githubToken. Any dependencies installed here will
# be part of the container image that gets cached, so subsequent
# builds don't have to re-install them. The image layer is cached
# publicly in your project's package repository, so it is vital that
# no secrets are present in the container state or logs.
install: |
case "${{ matrix.distro }}" in
ubuntu*|jessie|stretch|buster|bullseye)
apt-get update -q -y
apt-get install -q -y curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
source "${HOME}/.carago/env"
;;
esac
# Produce a binary result and place it in the mounted volume
run: |
cargo build --release
cp "${HOME}/target/release/system-monitor" "/result/${result_name}"
- name: Show the result
# Items placed in /result in the container will be in
# ${PWD}/result on the host.
run: |
ls -al "${PWD}/result"

0 comments on commit e2463e2

Please sign in to comment.