-
Notifications
You must be signed in to change notification settings - Fork 5
48 lines (48 loc) · 1.71 KB
/
docker-build-push.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
name: Build and push Docker image to DockerHub
on:
push:
branches:
- master
- dev
jobs:
runs-on: ubuntu-latest
steps:
- name: Branch name
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Branch name
run: echo "RUNNER_TMP=${RUNNER_TEMP}" >> $GITHUB_ENV
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: false
tags: radonconsortium/radon-ctt:${{ env.BRANCH }}
context: ./ctt-server
- name: Run tests with coverage
run: docker run -e 'CTT_TEST_MODE=True' -v '/home/runner/work/_temp/_github_home:/output' --entrypoint '/bin/sh' radonconsortium/radon-ctt:${{ env.BRANCH }} -c 'coverage run -m xmlrunner discover openapi_server/test/ -o /output/unittest && coverage xml -o /output/coverage.xml'
- name: Upload test artifacts
uses: actions/upload-artifact@v2
with:
name: test-artifacts
path: |
/home/runner/work/_temp/_github_home/coverage.xml
/home/runner/work/_temp/_github_home/unittest
push_docker_image:
needs: build_docker_image
name: Push Docker image to DockerHub
runs-on: ubuntu-latest
steps:
- name: Branch name
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.docker_hub_user }}
password: ${{ secrets.docker_hub_pass }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
tags: radonconsortium/radon-ctt:${{ env.BRANCH }}
context: ./ctt-server