-
Notifications
You must be signed in to change notification settings - Fork 11
65 lines (53 loc) · 1.64 KB
/
docker-tests.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
name: Docker API Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest numba
if [ -f "requirements.txt" ]; then pip install -r requirements.txt; fi
- name: Build Docker image
run: docker build -t mytestimage .
- name: Run Docker container
run: docker run -d --name mytestcontainer -p 7637:7637 mytestimage
- name: Run tests
run: pytest test/docker_tests/
- name: Login to Docker Hub
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: birchkwok/lynsedb:latest
platforms: linux/amd64, linux/arm64
- name: Cleanup
if: always()
run: docker stop mytestcontainer && docker rm mytestcontainer