mirror of
https://github.com/codex-storage/bittorrent-benchmarks.git
synced 2025-01-24 18:08:50 +00:00
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
name: Test and Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DOCKER_FILE: ./docker/bittorrent-benchmarks.Dockerfile
|
|
DOCKER_REPO: codexstorage/bittorrent-benchmarks
|
|
|
|
jobs:
|
|
test-and-build:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use Docker in rootless mode.
|
|
uses: ScribeMD/rootless-docker@0.2.2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Setup Docker Metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.DOCKER_REPO }}
|
|
flavor: |
|
|
latest=true
|
|
tags: |
|
|
type=sha
|
|
|
|
- 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: |
|
|
BUILD_TYPE=test
|
|
|
|
- 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
|
|
|
|
- name: Build and Push Prod. Image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ env.DOCKER_FILE }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }} |