mirror of
https://github.com/containers/youki
synced 2024-11-23 09:21:57 +01:00
155 lines
4.9 KiB
YAML
155 lines
4.9 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
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: |
|
|
.: src/**
|
|
./test_framework: test_framework/**
|
|
./youki_integration_test: youki_integration_test/**
|
|
./cgroups: cgroups/**
|
|
./seccomp: seccomp/**
|
|
check:
|
|
needs: [changes]
|
|
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust: [1.55.0, 1.54.0]
|
|
dirs: ${{ fromJSON(needs.changes.outputs.dirs) }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
override: true
|
|
- name: Cache youki
|
|
uses: Swatinem/rust-cache@v1
|
|
- name: Cache cgroups
|
|
uses: Swatinem/rust-cache@v1
|
|
with:
|
|
working-directory: ./cgroups
|
|
- run: rustup component add rustfmt clippy
|
|
- run: sudo apt-get -y update
|
|
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
|
|
- 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
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust: [1.55.0, 1.54.0]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
override: true
|
|
- name: Cache youki
|
|
uses: Swatinem/rust-cache@v1
|
|
- name: Cache cgroups
|
|
uses: Swatinem/rust-cache@v1
|
|
with:
|
|
working-directory: ./cgroups
|
|
- run: sudo apt-get -y update
|
|
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
|
|
- name: Run tests
|
|
run: cargo test --all --all-features --no-fail-fast
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
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: Cache cgroups
|
|
uses: Swatinem/rust-cache@v1
|
|
with:
|
|
working-directory: ./cgroups
|
|
- 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
|
|
run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
|
|
- name: Run Test Coverage for youki
|
|
run: |
|
|
cargo llvm-cov clean --workspace
|
|
cargo llvm-cov --no-report
|
|
cargo llvm-cov --no-run --lcov --output-path ./coverage.lcov
|
|
- name: Run Test Coverage for cgroups
|
|
working-directory: ./cgroups
|
|
run: |
|
|
cargo llvm-cov clean --workspace
|
|
cargo llvm-cov --no-report
|
|
cargo llvm-cov --no-run --lcov --output-path ./coverage.lcov
|
|
- name: Upload Youki Code Coverage Results
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
file: ./coverage.lcov
|
|
- name: Upload Cgroups Code Coverage Results
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
file: ./cgroups/coverage.lcov
|
|
integration_tests:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust: [1.55.0, 1.54.0]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
- 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
|
|
- name: Cache cgroups
|
|
uses: Swatinem/rust-cache@v1
|
|
with:
|
|
working-directory: ./cgroups
|
|
- run: sudo apt-get -y update
|
|
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
|
|
- name: Build
|
|
run: ./build.sh --release
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.11.0'
|
|
- name: Run intetgration tests
|
|
run: ./integration_test.sh
|