Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refactor CI #2012

Merged
merged 2 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/scripts/dependency.sh

This file was deleted.

55 changes: 53 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install requirements
run: sudo ./.github/scripts/dependency.sh
- name: Install just
uses: taiki-e/install-action@just
- name: Install requirements
run: just ci-prepare
- name: Build youki
run: just youki-release
- name: Upload youki binary
Expand Down Expand Up @@ -77,3 +77,54 @@ jobs:
# # - name: Debug
# # if: ${{ always() }}
# # uses: mxschmitt/action-tmate@v3

oci-validation-go:
runs-on: ubuntu-22.04
needs: [youki-build]
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install just
uses: taiki-e/install-action@just
- uses: actions/setup-go@v3
with:
go-version: '1.19.9'
cache: true
cache-dependency-path: tests/oci-runtime-tests/src/github.com/opencontainers/runtime-tools/go.sum
- name: Download youki binary
uses: actions/download-artifact@v3
with:
name: youki
- name: Add the permission to run
run: chmod +x ./youki
- name: Run integration tests
run: just oci-tests

oci-validation-rust:
runs-on: ubuntu-22.04
needs: [youki-build]
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install just
uses: taiki-e/install-action@just
- name: Install requirements
run: just ci-prepare
- name: Download youki binary
uses: actions/download-artifact@v3
with:
name: youki
- name: Add the permission to run
run: chmod +x ./youki
- name: Build
run: just runtimetest rust-oci-tests-bin
- name: Validate tests on youki
run: just rust-oci-tests
29 changes: 17 additions & 12 deletions .github/workflows/integration_tests_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,44 @@ on:

jobs:
changes:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 15
outputs:
dirs: ${{ steps.filter.outputs.changes }}
any_modified: ${{ steps.filter.outputs.any_modified }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
- uses: tj-actions/changed-files@v36
id: filter
with:
filters: |
./integration_test:
- './tests/rust-integration-tests/**'
files: |
.github/workflows/integration_tests_validation.yaml
integration_test/tests/rust-integration-tests/**
files_ignore: |
**.md
- name: List all changed files
run: |
for file in ${{ steps.filter.outputs.all_modified_files }}; do
echo "$file was changed"
done
validate:
needs: [changes]
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
if: needs.changes.outputs.any_modified == 'true'
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install requirements
run: sudo ./.github/scripts/dependency.sh
- name: Install just
uses: taiki-e/install-action@just
- name: Install requirements
run: just ci-prepare
- name: Install runc 1.1.0
run: |
wget -q https://github.com/opencontainers/runc/releases/download/v1.1.0/runc.amd64
sudo mv runc.amd64 /usr/bin/runc
sudo chmod 755 /usr/bin/runc
- name: Build
run: just youki-release runtimetest rust-oci-tests-bin
run: just runtimetest rust-oci-tests-bin
- name: Validate tests on runc
run: just validate-rust-oci-runc
- name: Validate tests on youki
run: just rust-oci-tests
98 changes: 35 additions & 63 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,62 @@ on:

jobs:
changes:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 15
outputs:
dirs: ${{ steps.filter.outputs.changes }}
any_modified: ${{ steps.filter.outputs.any_modified }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
- uses: tj-actions/changed-files@v36
id: filter
with:
filters: |
crates/youki:
- 'crates/youki/**'
crates/libcontainer:
- 'crates/libcontainer/**'
crates/libcgroups:
- 'crates/libcgroups/**'
tests/rust-integration-tests/runtimetest:
- './tests/rust-integration-tests/runtimetest/**'
tests/rust-integration-tests/integration_test:
- './tests/rust-integration-tests/integration_test/**'
tests/rust-integration-tests/test_framework:
- './tests/rust-integration-tests/test_framework/**'

files_ignore: |
docs
LICENSE
**.md
- name: List all changed files
run: |
for file in ${{ steps.filter.outputs.all_modified_files }}; do
echo "$file was changed"
done
check:
needs: [changes]
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
runs-on: ubuntu-20.04
if: needs.changes.outputs.any_modified == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
matrix:
dirs: ${{ fromJSON(needs.changes.outputs.dirs) }}
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- run: rustup component add rustfmt clippy
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- uses: taiki-e/install-action@just
- name: Install requirements
run: sudo ./.github/scripts/dependency.sh
- 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
run: just ci-prepare
- name: Check formatting and lints
run: just lint

tests:
runs-on: ubuntu-20.04
needs: [changes]
if: needs.changes.outputs.any_modified == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Install rus
run: rustup show
- 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: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@just
- name: Install requirements
run: just ci-prepare
- name: Run tests
run: |
export LD_LIBRARY_PATH=$HOME/.wasmedge/lib
cd ./crates && cargo test --all --all-features --no-fail-fast

coverage:
runs-on: ubuntu-20.04
needs: [changes]
if: needs.changes.outputs.any_modified == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 15
name: Run test coverage
steps:
Expand All @@ -83,37 +77,15 @@ jobs:
uses: taiki-e/install-action@v1
with:
tool: cargo-llvm-cov@0.4.0
- uses: taiki-e/install-action@just
- name: Install requirements
run: sudo ./.github/scripts/dependency.sh
run: just ci-prepare
- name: Run Test Coverage for youki
run: |
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report
cargo llvm-cov --no-run --lcov --ignore-filename-regex "libcgroups/src/systemd/dbus/systemd_api.rs" --output-path ./coverage.lcov
- name: Upload Youki Code Coverage Results
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
file: ./coverage.lcov

integration_tests:
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install requirements
run: sudo ./.github/scripts/dependency.sh
- name: Install just
uses: taiki-e/install-action@just
- uses: actions/setup-go@v3
with:
go-version: "1.17.6"
cache: true
cache-dependency-path: tests/oci-runtime-tests/src/github.com/opencontainers/runtime-tools/go.sum
- name: Build
run: just youki-release
- name: Run integration tests
run: just oci-tests
Loading