-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (79 loc) · 2.45 KB
/
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Azafea Metrics Proxy Tests
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker Image
run: docker build --tag amp .
- name: Save Docker Image
run: docker save amp > docker-image.tar
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: image
path: docker-image.tar
tests:
name: Integration Tests
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Docker Image
uses: actions/download-artifact@v4
with:
name: image
- name: Load Docker Image
run: docker load < docker-image.tar
- name: Install Docker Images
run: docker run -d --name=redis --network=host redis:5-alpine --requirepass 'CHANGE ME!!'
- name: Run Tests
run: docker run --rm --network=host --entrypoint="" amp pipenv run test-all
- name: Remove Docker Images
run: docker rm -f redis
lint:
name: Lint and Type Checking
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Docker Image
uses: actions/download-artifact@v4
with:
name: image
- name: Load Docker Image
run: docker load < docker-image.tar
- name: Lint
run: docker run --rm --entrypoint="" amp pipenv run lint
- name: Type Checking
run: docker run --rm --entrypoint="" amp pipenv run type-check
push:
name: Upload the Docker image to Docker Hub
runs-on: ubuntu-latest
# We only want to publish a new image when the master branch changes, not
# for PRs and only if tests finish successfully.
needs: tests
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: '${{ secrets.DOCKERHUB_USERNAME }}'
password: '${{ secrets.DOCKERHUB_TOKEN }}'
- name: Get Docker Image
uses: actions/download-artifact@v4
with:
name: image
- name: Load Docker Image
run: docker load < docker-image.tar
- name: Upload the image
run: |
docker tag amp endlessm/azafea-metrics-proxy:latest
docker push endlessm/azafea-metrics-proxy:latest