2025-01-08 16:05:08 +02:00

78 lines
2.0 KiB
YAML

name: Test and Build Experiment Runner Image
on:
push:
branches:
- master
tags:
- 'v*.*.*'
workflow_dispatch:
env:
DOCKER_FILE: ./docker/bittorrent-benchmarks.Dockerfile
DOCKER_REPO: codexstorage/bittorrent-benchmarks
BUILD_ARGS: |
BUILD_TYPE=test
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Test Image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKER_FILE }}
push: false
load: true
tags: bittorrent-benchmarks:test
build-args: |
${{ env.BUILD_ARGS }}
- name: Lint
run: |
docker run --rm --entrypoint poetry bittorrent-benchmarks:test run ruff check
- name: Type Check
run: |
docker run --rm --entrypoint poetry bittorrent-benchmarks:test run mypy .
- name: Run Unit Tests
run: |
docker run --rm --entrypoint poetry bittorrent-benchmarks:test run pytest -m "not integration"
- name: Run Integration Tests
run: |
docker compose -f docker-compose.local.yaml -f docker-compose.ci.yaml up --abort-on-container-exit --exit-code-from test-runner
variables:
name: Compute outputs
needs: build-and-test
runs-on: ubuntu-latest
outputs:
docker_file: ${{ env.DOCKER_FILE }}
dockerhub_repo: ${{ env.DOCKER_REPO }}
build_args: ${{ env.BUILD_ARGS }}
steps:
- name: Dummy job
if: false
run: echo
build-and-push:
name: Build and Push
needs: variables
uses: codex-storage/github-actions/.github/workflows/docker-reusable.yml@master
with:
docker_file: ${{ needs.variables.outputs.docker_file }}
dockerhub_repo: ${{ needs.variables.outputs.dockerhub_repo }}
build_args: |
${{ needs.variables.outputs.build_args }}
secrets: inherit