Skip to content

Continuous integration #149

Continuous integration

Continuous integration #149

Workflow file for this run

name: Continuous integration
on:
schedule:
- cron: "30 5 * * 5"
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
name: Setup toolchain
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Fmt
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Test
env:
CI: true
run: cargo test
integration:
runs-on: ubuntu-latest
needs: ci
strategy:
fail-fast: false
matrix:
k8s: [v1.27, latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: nolar/setup-k3d-k3s@v1
with:
version: ${{matrix.k8s}}
k3d-name: kube
# Used to avoid rate limits when fetching the releases from k3s repo.
# Anonymous access is limited to 60 requests / hour / worker
github-token: ${{ secrets.GITHUB_TOKEN }}
k3d-args: "--no-lb --no-rollback --k3s-arg --disable=traefik,servicelb,metrics-server@server:*"
# Real CI work starts here
- name: Build workspace
run: cargo build
# Run the integration tests
- name: Install CRDs
run: cargo run --bin git-events-runner crds | kubectl apply -f -
- name: Run all integration tests
run: cargo test --all -- --ignored
docker-test:
runs-on: ubuntu-latest
needs: ci
strategy:
matrix:
binary:
- git-events-runner
- gitrepo-cloner
- action-worker
steps:
- uses: actions/checkout@v4
- name: Test image build
run: docker build -f docker-build/${{matrix.binary}}.dockerfile .
docs-test:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Configure cache
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Apply cache
uses: actions/cache@v4
with:
key: mkdocs-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-
- name: Install dependencies
run: pip install -r .github/mkdocs-requirements.txt
- name: Test build
run: mkdocs build -s