-
Notifications
You must be signed in to change notification settings - Fork 33
66 lines (56 loc) · 2.44 KB
/
e2e.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
name: Docker Image CI
on: [push]
jobs:
build-test-release:
name: Build, Test and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: ./docker-build.sh "${GITHUB_REF_SLUG}"
- name: Run tests
run: docker run --rm -e PROCESS_TYPE=test --name django-coleman "mrsarm/django-coleman:${GITHUB_REF_SLUG}"
- name: Release Docker image
if: ${{ github.ref != 'refs/heads/master' }}
run: docker push "mrsarm/django-coleman:${GITHUB_REF_SLUG}"
- name: Get GitHub downloader
run: wget https://gist.github.com/mrsarm/95279381f3d8bf4269499fb437888e2c/raw/github-file.sh
- name: Get compose.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./github-file.sh compose.yaml mrsarm/dcoleman-e2e $GITHUB_REF_SLUG main $GITHUB_TOKEN
- name: Get .env.example
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./github-file.sh .env.example mrsarm/dcoleman-e2e $GITHUB_REF_SLUG main $GITHUB_TOKEN
- name: Setup environment variables
run: cp .env.example .env
- name: Download pose
if: ${{ github.ref != 'refs/heads/master' }}
run: wget https://github.com/mrsarm/pose/releases/download/0.4.0-b4/pose-0.4.0-b4-x86_64-unknown-linux-gnu.tar.gz
- name: Unpack pose
if: ${{ github.ref != 'refs/heads/master' }}
run: tar -xvf pose*.tar.gz
- name: Build compose file for CI with pose
if: ${{ github.ref != 'refs/heads/master' }}
run: ./pose --no-docker config --tag "${GITHUB_REF_SLUG}" --tag-filter regex=mrsarm/ --progress -o ci.yaml
- name: Create compose file for CI without pose
if: ${{ github.ref == 'refs/heads/master' }}
run: cp compose.yaml ci.yaml
- name: Pull images
run: docker compose -f ci.yaml pull
- name: Run e2e tests
run: docker compose -f ci.yaml run dcoleman-e2e
- name: Tag "latest"
if: ${{ github.ref == 'refs/heads/master' }}
run: docker tag "mrsarm/django-coleman:${GITHUB_REF_SLUG}" mrsarm/django-coleman:latest
- name: Release "latest"
if: ${{ github.ref == 'refs/heads/master' }}
run: docker push mrsarm/django-coleman:latest