Skip to content

优化路径匹配逻辑 #21

优化路径匹配逻辑

优化路径匹配逻辑 #21

Workflow file for this run

name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
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@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"
--volume "${GITHUB_WORKSPACE}/system-monitor:/system-monitor"
# 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/bash
# 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
. "${HOME}/.cargo/env"
;;
esac
# Produce a binary result and place it in the mounted volume
run: |
. "${HOME}/.cargo/env"
cd /system-monitor
cargo build --release
cp "${PWD}/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"