-
Notifications
You must be signed in to change notification settings - Fork 10
62 lines (53 loc) · 1.99 KB
/
test.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
name: Test
on:
workflow_dispatch:
push:
branches:
- develop
- master
pull_request:
branches:
- develop
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
# Check out GitHub reportiory
- uses: actions/checkout@v4
# Set the tag for the build
- name: Set tag name
run: |
if [[ "${{ github.ref }}" == "refs/heads/develop" || "${{ github.base_ref }}" == "develop" ]]; then
echo "TAG=staging" >> $GITHUB_ENV
else
echo "TAG=prod" >> $GITHUB_ENV
fi
# Setup transcrypt so that we can read secrets
- name: Checkout transcrypt
uses: actions/checkout@v4
with:
repository: elasticdog/transcrypt
path: transcrypt
- name: Initialise transcrypt
run: ./transcrypt/transcrypt -c aes-256-cbc -p '${{ secrets.TRANSCRYPT_PASSWORD }}' --yes
- name: Build frontend container image
run: docker build -t clerk-webpack:local -f docker/Dockerfile.webpack .
# Build the clerk Docker image so that we can run tests
- name: Build container image
run: docker build -t anikalaw/clerk:${TAG} -f docker/Dockerfile .
# Run clerk unit tests
- name: Run unit tests
run: docker compose -f docker/docker-compose.ci.yml run --rm test pytest -vv
# If the tests passed and we're on master/develop, then login to DockerHub
- name: Login to DockerHub
if: success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
uses: docker/login-action@v3
with:
username: anikalaw
password: ${{ secrets.DOCKER_PASSWORD }}
# If the tests passed and we're on master/develop, then push the image to DockerHub
# This image will be used for the next deployment.
- name: Push container image
if: success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
run: docker push anikalaw/clerk:${TAG}