-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 1.99 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Test and Build Experiment Runner Image
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: 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: 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
- 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 }}