-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (38 loc) · 1.36 KB
/
build.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
# Build docker image on every commit and run tests in it
# Push new release image after version tag push
name: build and test
on:
push:
pull_request:
schedule:
- cron: '20 4 * * 1' # every week
jobs:
build:
runs-on: "ubuntu-20.04"
env:
DOCKER_REPO: ischluff/voctoquality
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build the Docker image
run: DOCKER_BUILDKIT=1 docker build . --progress=plain --file Dockerfile --tag build
- name: Run tests
run: docker run --rm -v $(pwd):/root build make test coverage
- name: Codecov
uses: codecov/[email protected]
with:
file: data/coverage.xml
- name: Set version from tag
if: success() && github.ref == 'refs/heads/master'
run: echo "::set-env name=version::$(git tag --points-at ${GITHUB_SHA} | tail -n 1)"
# Push package for tagged versions on master
- name: Release docker
if: success() && github.ref == 'refs/heads/master' && env.version != ''
run: |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
docker tag build ${DOCKER_REPO}:${version}
docker tag build ${DOCKER_REPO}:latest
docker push ${DOCKER_REPO}:${version}
docker push ${DOCKER_REPO}:latest