2024-12-18 14:34:22 -03:00
|
|
|
name: Test and Build Experiment Runner Image
|
2024-12-02 17:10:18 -03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2025-01-08 16:05:08 +02:00
|
|
|
tags:
|
|
|
|
- 'v*.*.*'
|
2024-12-02 17:10:18 -03:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
2024-12-04 19:04:57 -03:00
|
|
|
DOCKER_FILE: ./docker/bittorrent-benchmarks.Dockerfile
|
2024-12-02 17:10:18 -03:00
|
|
|
DOCKER_REPO: codexstorage/bittorrent-benchmarks
|
2025-01-08 16:05:08 +02:00
|
|
|
BUILD_ARGS: |
|
|
|
|
BUILD_TYPE=test
|
2024-12-02 17:10:18 -03:00
|
|
|
|
|
|
|
jobs:
|
2025-01-08 16:05:08 +02:00
|
|
|
build-and-test:
|
|
|
|
name: Build and Test
|
2024-12-02 17:10:18 -03:00
|
|
|
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: |
|
2025-01-08 16:05:08 +02:00
|
|
|
${{ env.BUILD_ARGS }}
|
2024-12-02 17:10:18 -03:00
|
|
|
|
2024-12-14 06:35:37 -03:00
|
|
|
- name: Lint
|
|
|
|
run: |
|
|
|
|
docker run --rm --entrypoint poetry bittorrent-benchmarks:test run ruff check
|
|
|
|
|
2024-12-02 17:10:18 -03:00
|
|
|
- name: Type Check
|
|
|
|
run: |
|
2024-12-04 19:04:57 -03:00
|
|
|
docker run --rm --entrypoint poetry bittorrent-benchmarks:test run mypy .
|
2024-12-02 17:10:18 -03:00
|
|
|
|
|
|
|
- name: Run Unit Tests
|
|
|
|
run: |
|
2025-01-30 18:34:32 -03:00
|
|
|
docker run --rm --entrypoint poetry bittorrent-benchmarks:test run pytest -m \
|
|
|
|
"not codex_integration and not deluge_integration"
|
2024-12-02 17:10:18 -03:00
|
|
|
|
2025-01-30 18:34:32 -03:00
|
|
|
- name: Run Deluge Integration Tests
|
2024-12-03 19:33:43 -03:00
|
|
|
run: |
|
2025-01-30 18:34:32 -03:00
|
|
|
docker compose -f docker-compose-deluge.local.yaml \
|
|
|
|
-f docker-compose-deluge.ci.yaml up --abort-on-container-exit --exit-code-from test-runner
|
|
|
|
|
|
|
|
- name: Run Codex Integration Tests
|
|
|
|
run: |
|
|
|
|
docker compose -f docker-compose-codex.local.yaml \
|
|
|
|
-f docker-compose-codex.ci.yaml up --abort-on-container-exit --exit-code-from test-runner
|
2024-12-03 19:33:43 -03:00
|
|
|
|
2025-01-08 16:05:08 +02:00
|
|
|
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
|