Skip to content

Commit

Permalink
ci: Use new docker-supporting backend workflows
Browse files Browse the repository at this point in the history
Kick CI again?
  • Loading branch information
tlater-famedly committed Feb 7, 2025
1 parent faf18a0 commit 623d77e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 90 deletions.
7 changes: 7 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
7 changes: 7 additions & 0 deletions .config/sedmounts.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .config/starte2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
92 changes: 2 additions & 90 deletions .github/workflows/rust-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,101 +8,13 @@ on:
pull_request:
branches: [ "*" ]

env:
CARGO_TERM_COLOR: always

# Make sure there is no pipeline running uselessly.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# 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@444eafd670337dea97054e1911f852ac468ae21d
secrets: inherit

0 comments on commit 623d77e

Please sign in to comment.