1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-18 13:36:14 +02:00
youki/.github/workflows/main.yml

130 lines
4.3 KiB
YAML
Raw Normal View History

2021-04-04 03:54:09 +02:00
on:
push:
2021-04-04 03:54:09 +02:00
branches:
- main
pull_request:
2021-04-04 03:54:09 +02:00
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
outputs:
dirs: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
2021-10-21 18:09:26 +02:00
./crates/youki: crates/youki/**
./crates/libcontainer: crates/libcontainer/**
./crates/libcgroups: crates/libcgroups/**
./crates/libseccomp: crates/libseccomp/**
2022-01-08 10:46:14 +01:00
./crates/integration_test: crates/integration_test/**
./runtimetest : runtimetest/**
check:
2021-09-06 07:30:50 +02:00
needs: [changes]
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
2021-07-11 09:20:53 +02:00
runs-on: ubuntu-latest
strategy:
matrix:
2021-12-09 04:40:42 +01:00
rust: [1.56.1, 1.57.0]
dirs: ${{ fromJSON(needs.changes.outputs.dirs) }}
2021-07-11 09:20:53 +02:00
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
- run: rustup component add rustfmt clippy
- run: sudo apt-get -y update
2021-09-14 08:54:35 +02:00
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
2021-07-11 09:20:53 +02:00
- name: Check formatting
run: cargo fmt --all -- --check
working-directory: ${{matrix.dirs}}
- name: Check clippy lints
working-directory: ${{matrix.dirs}}
run: cargo clippy --all-targets --all-features -- -D warnings
2021-04-29 10:34:23 +02:00
tests:
runs-on: ubuntu-latest
strategy:
matrix:
2021-12-09 04:40:42 +01:00
rust: [1.56.1, 1.57.0]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
2021-08-31 12:36:42 +02:00
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
- run: sudo apt-get -y update
2021-09-14 08:54:35 +02:00
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
2021-04-29 10:34:23 +02:00
- name: Run tests
2021-09-09 16:07:06 +02:00
run: cargo test --all --all-features --no-fail-fast
coverage:
runs-on: ubuntu-latest
2021-09-06 07:30:50 +02:00
name: Run test coverage
steps:
- uses: actions/checkout@v2
- name: Toolchain setup
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
components: llvm-tools-preview
- name: Cache youki
uses: Swatinem/rust-cache@v1
- name: install cargo-llvm-cov
env:
CARGO_LLVM_COV_VERSION: 0.1.5
run: |
wget https://github.com/taiki-e/cargo-llvm-cov/releases/download/v${CARGO_LLVM_COV_VERSION}/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz -qO- | tar -xzvf -
mv cargo-llvm-cov ~/.cargo/bin
- name: Update System Libraries
run: sudo apt-get -y update
- name: Install System Libraries
2021-09-14 08:54:35 +02:00
run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
2021-09-06 07:30:50 +02:00
- name: Run Test Coverage for youki
run: |
cargo llvm-cov clean --workspace
2021-09-06 07:30:50 +02:00
cargo llvm-cov --no-report
2022-01-04 18:15:51 +01:00
cargo llvm-cov --no-run --lcov --ignore-filename-regex "libseccomp/src|integration_test/src|test_framework/src|systemd_api.rs" --output-path ./coverage.lcov
2021-09-06 07:30:50 +02:00
- name: Upload Youki Code Coverage Results
uses: codecov/codecov-action@v2
with:
file: ./coverage.lcov
2021-04-29 10:34:23 +02:00
integration_tests:
2021-04-04 03:54:09 +02:00
runs-on: ubuntu-latest
strategy:
matrix:
2021-12-09 04:40:42 +01:00
rust: [1.56.1, 1.57.0]
2021-04-04 03:54:09 +02:00
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
2021-09-07 15:24:52 +02:00
- name: Cache runtime-tools
id: cache-runtime-tools
uses: actions/cache@v2
with:
path: integration_test
key: ${{ runner.os }}-${{ matrix.rust }}-primes
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Cache youki
uses: Swatinem/rust-cache@v1
- run: sudo apt-get -y update
2021-09-14 08:54:35 +02:00
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
2021-06-07 14:04:28 +02:00
- name: Build
2021-07-31 10:33:59 +02:00
run: ./build.sh --release
2021-04-04 03:54:09 +02:00
- uses: actions/setup-go@v2
with:
2021-09-18 17:20:07 +02:00
go-version: '1.11.0'
2021-10-21 18:09:26 +02:00
- name: Run integration tests
run: ./integration_test.sh