amdgpud/.github/workflows/rust.yml
2022-01-28 10:19:29 +01:00

101 lines
4.0 KiB
YAML

name: Rust
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
tests:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Add key
run: wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
- name: Add repo
env:
UBUNTU: ${{ matrix.os }}
run: echo $UBUNTU &&\
[[ "${UBUNTU}" == "ubuntu-18.04" ]]&&\
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null || echo 1;
- name: Install binary compressor
run: sudo apt-get update && sudo apt-get install upx-ucl xcb libxcb-shape0 libxcb-xfixes0 libxcb-record0 libxcb-shape0-dev libxcb-xfixes0-dev libxcb-record0-dev cmake
- name: Add target
run: rustup target install x86_64-unknown-linux-musl
- name: Run fmt check
run: cargo fmt -- --check
- name: Run tests
run: cargo test --verbose
clippy:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Add key
run: wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
- name: Add repo
env:
UBUNTU: ${{ matrix.os }}
run: echo $UBUNTU &&\
[[ "${UBUNTU}" == "ubuntu-18.04" ]]&&\
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null || echo 1;
- name: Install binary compressor
run: sudo apt-get update && sudo apt-get install upx-ucl xcb libxcb-shape0 libxcb-xfixes0 libxcb-record0 libxcb-shape0-dev libxcb-xfixes0-dev libxcb-record0-dev cmake
- name: Add target
run: rustup target install x86_64-unknown-linux-musl
- name: Run clippy
run: cargo clippy -- -D warnings
build:
needs: [clippy, tests]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Add key
run: wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
- name: Add repo
env:
UBUNTU: ${{ matrix.os }}
run: echo $UBUNTU &&\
[[ "${UBUNTU}" == "ubuntu-18.04" ]]&&\
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null || echo 1;
- name: Install binary compressor
run: sudo apt-get update && sudo apt-get install upx-ucl xcb libxcb-shape0 libxcb-xfixes0 libxcb-record0 libxcb-shape0-dev libxcb-xfixes0-dev libxcb-record0-dev cmake zip
- name: Add target
run: rustup target install x86_64-unknown-linux-musl
- name: Compile
run: bash ./scripts/compile.sh
- name: Optimize
run: bash ./scripts/build.sh
- name: Collect artifacts
env:
OS: ${{ matrix.os }}
run: ./scripts/zip-ci.sh $OS
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.4
with:
# Artifact name
name: binaries-${{ matrix.os }}.zip
# A file, directory or wildcard pattern that describes what to upload
path: ./binaries-${{ matrix.os }}.zip
# The desired behavior if no files are found using the provided path.