From 3ed3c2b6c0841be42db98f15906e53c22b40885b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Wed, 5 Feb 2025 13:38:08 +0800 Subject: [PATCH] ci: Use new docker-supporting backend workflows Kick CI again? --- .config/nextest.toml | 7 +++ .config/sedmounts.sh | 7 +++ .config/starte2e.sh | 2 + .github/workflows/rust-workflow.yml | 92 +---------------------------- 4 files changed, 18 insertions(+), 90 deletions(-) create mode 100755 .config/sedmounts.sh diff --git a/.config/nextest.toml b/.config/nextest.toml index 6da7054..59a68bc 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -8,6 +8,9 @@ experimental = ["setup-scripts"] # already exist) - we don't want this. e2e = { max-threads = 1 } +[script.sed-mounts-ci] +command = "./.config/sedmounts.sh" + [script.start-e2e-env] command = "./.config/starte2e.sh" @@ -26,3 +29,7 @@ fail-fast = false path = "junit.xml" store-success-output = true store-failure-output = true + +[[profile.ci.scripts]] +filter = "test(e2e)" +setup = "sed-mounts-ci" diff --git a/.config/sedmounts.sh b/.config/sedmounts.sh new file mode 100755 index 0000000..672545c --- /dev/null +++ b/.config/sedmounts.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +# Change the volume mounts to point to the correct host paths in CI +# runners +sed 's|source: \./|source: /home/runner/work/famedly-sync/famedly-sync/|g' -i tests/environment/docker-compose.yaml diff --git a/.config/starte2e.sh b/.config/starte2e.sh index 5fa94ff..bad2903 100755 --- a/.config/starte2e.sh +++ b/.config/starte2e.sh @@ -18,6 +18,8 @@ then ldap_down="-v ldap" fi +cat ./tests/environment/docker-compose.yaml + # Shut down any still running test-setup first docker compose --project-directory ./tests/environment down -v test-setup $ldap_down || true docker compose --project-directory ./tests/environment up --wait diff --git a/.github/workflows/rust-workflow.yml b/.github/workflows/rust-workflow.yml index 4594c28..799ac59 100644 --- a/.github/workflows/rust-workflow.yml +++ b/.github/workflows/rust-workflow.yml @@ -8,9 +8,6 @@ on: pull_request: branches: [ "*" ] -env: - CARGO_TERM_COLOR: always - # Make sure there is no pipeline running uselessly. concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,91 +15,6 @@ concurrency: # Defined CI jobs. jobs: - simple-checks: - container: docker-oss.nexus.famedly.de/rust-container:nightly - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - - - uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main - with: - gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}} - gitlab_user: ${{ secrets.GITLAB_USER }} - gitlab_pass: ${{ secrets.GITLAB_PASS }} - - - name: Caching - uses: Swatinem/rust-cache@68b3cb7503c78e67dae8373749990a220eb65352 - with: - cache-on-failure: true - cache-all-crates: true - - - name: Rustfmt - shell: bash - run: cargo +${NIGHTLY_VERSION} fmt -- --check - - - name: Clippy - shell: bash - run: cargo +${NIGHTLY_VERSION} clippy --workspace --all-targets -- -D warnings - - - name: Doc-test - shell: bash - run: cargo +${NIGHTLY_VERSION} test --doc --workspace --verbose - - - name: Udeps - shell: bash - run: cargo +${NIGHTLY_VERSION} udeps - - - name: Typos - shell: bash - run: typos --exclude '*.key' --exclude '*.crt' --exclude '*.csr' --exclude '*.srl' - tests: - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - - - uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main - with: - gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}} - gitlab_user: ${{ secrets.GITLAB_USER }} - gitlab_pass: ${{ secrets.GITLAB_PASS }} - - - name: Add llvm-tools rust component - run: rustup component add llvm-tools-preview --toolchain stable-x86_64-unknown-linux-gnu - - - name: Caching - uses: Swatinem/rust-cache@68b3cb7503c78e67dae8373749990a220eb65352 - with: - cache-on-failure: true - cache-all-crates: true - - - name: Install additional cargo tooling - shell: bash - run: cargo install cargo-nextest cargo-llvm-cov --locked - - - name: Test - timeout-minutes: 20 - shell: bash - run: | - docker compose --project-directory ./tests/environment down -v - cargo llvm-cov nextest --profile ci --workspace --lcov --output-path lcov.info - - - name: Get docker logs on failure - shell: bash - if: failure() - run: | - docker compose --project-directory ./tests/environment logs - - - name: Codecov - Upload coverage - uses: codecov/codecov-action@v4 - with: - token: ${{secrets.CODECOV_TOKEN}} - files: lcov.info - - - name: Codecov - Upload test results - uses: codecov/test-results-action@v1 - with: - token: ${{secrets.CODECOV_TOKEN}} - + uses: famedly/backend-build-workflows/.github/workflows/rust-workflow.yml@8fa286305f20cc2aaa1898b931f7188d3e19eeb6 + secrets: inherit