summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2023-12-18 09:17:33 +0100
committerMarkus Pettersson <markus.pettersson@mullvad.net>2023-12-18 09:17:33 +0100
commit9eb6d7f1ef93e21cf7748fd8d5b0dd4591e0ebbd (patch)
tree0c6dca1f3f512009bdde7302307d7fabc76917e5 /.github/workflows
parentd337e05f20374a5bc80b0c7e8dcfbbf10131201d (diff)
parente14ccfe2075971b0be1dc63273911b128c46d5cf (diff)
downloadmullvadvpn-9eb6d7f1ef93e21cf7748fd8d5b0dd4591e0ebbd.tar.xz
mullvadvpn-9eb6d7f1ef93e21cf7748fd8d5b0dd4591e0ebbd.zip
Merge branch 'ci/add-test-runner-ci'
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/android-app.yml1
-rw-r--r--.github/workflows/testframework-clippy.yml73
-rw-r--r--.github/workflows/testframework-rustfmt.yml29
-rw-r--r--.github/workflows/testframework.yml111
4 files changed, 214 insertions, 0 deletions
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml
index 13d5c011a6..77e7266bfd 100644
--- a/.github/workflows/android-app.yml
+++ b/.github/workflows/android-app.yml
@@ -13,6 +13,7 @@ on:
- '!graphics/**'
- '!gui/**'
- '!ios/**'
+ - '!test/**'
- '!scripts/**'
- '!windows/**'
- '!**/**.md'
diff --git a/.github/workflows/testframework-clippy.yml b/.github/workflows/testframework-clippy.yml
new file mode 100644
index 0000000000..670001c882
--- /dev/null
+++ b/.github/workflows/testframework-clippy.yml
@@ -0,0 +1,73 @@
+# Run `clippy` on the `test` workspace
+---
+name: DES Testframework - Clippy
+on:
+ pull_request:
+ paths:
+ - 'test/**/*.rs'
+ - .github/workflows/clippy-test.yml
+ - clippy.toml
+ workflow_dispatch:
+jobs:
+ clippy-check-test:
+ name: Clippy linting of test workspace
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Install Protoc
+ uses: arduino/setup-protoc@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+
+ - uses: actions-rs/toolchain@v1.0.6
+ with:
+ toolchain: stable
+ components: clippy
+ override: true
+
+ - name: Install build dependencies
+ if: matrix.os == 'ubuntu-latest'
+ run: |
+ sudo apt-get update
+ sudo apt-get install libdbus-1-dev
+
+ - name: Clippy check
+ working-directory: test
+ shell: bash
+ env:
+ RUSTFLAGS: --deny warnings
+ run: |
+ time cargo clippy --locked -- -W clippy::unused_async
+
+ clippy-check-test-windows:
+ name: Clippy linting of test workspace (Windows)
+ runs-on: windows-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Install Protoc
+ uses: arduino/setup-protoc@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+
+ - uses: actions-rs/toolchain@v1.0.6
+ with:
+ toolchain: stable
+ components: clippy
+ override: true
+
+ - name: Clippy check
+ working-directory: test
+ shell: bash
+ env:
+ RUSTFLAGS: --deny warnings
+ run: |
+ # Exclude checking test-manager on Windows, since it is not a supported compilation target.
+ time cargo clippy --workspace --exclude test-manager --locked -- -W clippy::unused_async
diff --git a/.github/workflows/testframework-rustfmt.yml b/.github/workflows/testframework-rustfmt.yml
new file mode 100644
index 0000000000..8889653183
--- /dev/null
+++ b/.github/workflows/testframework-rustfmt.yml
@@ -0,0 +1,29 @@
+# Run `cargo fmt --check` on the `test` workspace
+---
+name: DES Testframework - Check formatting
+on:
+ pull_request:
+ paths:
+ - 'test/**/*.rs'
+ - .github/workflows/rustfmt-test.yml
+ - rustfmt.toml
+ workflow_dispatch:
+jobs:
+ check-formatting-test:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Install Rust
+ uses: actions-rs/toolchain@v1.0.6
+ with:
+ toolchain: stable
+ components: rustfmt
+ default: true
+
+ - name: Check formatting
+ working-directory: test
+ run: |-
+ rustfmt --version
+ cargo fmt -- --check
diff --git a/.github/workflows/testframework.yml b/.github/workflows/testframework.yml
new file mode 100644
index 0000000000..f382567c52
--- /dev/null
+++ b/.github/workflows/testframework.yml
@@ -0,0 +1,111 @@
+# Compile the test framework
+---
+name: DES Testframework - Build
+on:
+ pull_request:
+ paths:
+ - '**'
+ - '!**/**.md'
+ - '!.github/workflows/**'
+ - '.github/workflows/daemon.yml'
+ - '!android/**'
+ - '!audits/**'
+ - '!build-apk.sh'
+ - '!build.sh'
+ - '!clippy.toml'
+ - '!deny.toml'
+ - '!docs/**'
+ - '!graphics/**'
+ - '!gui/**'
+ - '!ios/**'
+ - '!scripts/**'
+ - '!.*ignore'
+ - '!prepare-release.sh'
+ - '!rustfmt.toml'
+ - '!.yamllint'
+ workflow_dispatch:
+jobs:
+ prepare-build-test-framework-linux:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Use custom container image if specified
+ if: ${{ github.event.inputs.override_container_image != '' }}
+ run: echo "inner_container_image=${{ github.event.inputs.override_container_image }}"
+ >> $GITHUB_ENV
+
+ - name: Use default container image and resolve digest
+ if: ${{ github.event.inputs.override_container_image == '' }}
+ run: |
+ echo "inner_container_image=$(cat ./building/linux-container-image.txt)" >> $GITHUB_ENV
+
+ outputs:
+ container_image: ${{ env.inner_container_image }}
+
+ # Build the test runner + test manager at once.
+ build-test-framework-linux:
+ needs: prepare-build-test-framework-linux
+ runs-on: ubuntu-latest
+ container:
+ image: ${{ needs.prepare-build-test-framework-linux.outputs.container_image }}
+
+ steps:
+ # Fix for HOME path overridden by GH runners when building in containers, see:
+ # https://github.com/actions/runner/issues/863
+ - name: Fix HOME path
+ run: echo "HOME=/root" >> $GITHUB_ENV
+
+ - name: Install system dependencies # Needed to build test-manager, and is not included in the app container.
+ run: apt update && apt install -y pkg-config libssl-dev libpcap-dev
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Build test framework
+ working-directory: test
+ run: cargo build --release
+
+ # Build the test runner + test manager at once.
+ build-test-framework-macos:
+ runs-on: macos-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Install Protoc
+ uses: arduino/setup-protoc@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Install Rust
+ uses: actions-rs/toolchain@v1.0.6
+ with:
+ toolchain: stable
+ default: true
+
+ - name: Build test runner
+ working-directory: test
+ run: cargo build
+
+ # Build only the test-runner binary on Windows. Windows is not a supported host for test-manager.
+ build-test-runner-windows:
+ # Cross-compile the test runner for Windows from Linux.
+ needs: prepare-build-test-framework-linux
+ runs-on: ubuntu-latest
+ container:
+ image: ${{ needs.prepare-build-test-framework-linux.outputs.container_image }}
+ continue-on-error: true
+ steps:
+ # Fix for HOME path overridden by GH runners when building in containers, see:
+ # https://github.com/actions/runner/issues/863
+ - name: Fix HOME path
+ run: echo "HOME=/root" >> $GITHUB_ENV
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Build test runner
+ working-directory: test
+ run: cargo build --release -p test-runner --target x86_64-pc-windows-gnu