-
Notifications
You must be signed in to change notification settings - Fork 18
81 lines (78 loc) · 2.6 KB
/
xcube_workflow.yaml
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
name: Unittest and docker builds
on:
push:
release:
types: [published]
jobs:
unittest:
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: 1
steps:
- uses: actions/checkout@v2
# Setup miniconda nd build env
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge
activate-environment: xcube
environment-file: environment.yml
# Setup xcube
- name: setup-xcube
shell: bash -l {0}
run: |
conda info
conda list
python setup.py develop
# Run unittests
- name: unittest-xcube
shell: bash -l {0}
run: |
pip install pytest pytest-cov
mamba install -c conda-forge flask-testing moto requests-mock
pytest --cov=./ --cov-report=xml
- uses: codecov/codecov-action@v1
with:
verbose: true # optional (default = false)
build-docker-image:
runs-on: ubuntu-latest
# Only run if unittests succeed
needs: unittest
# Build the docker image and push to quay.io
name: build-docker-image
env:
APP_NAME: xcube
ORG_NAME: bc-org
steps:
- name: git-checkout
uses: actions/checkout@v2
# Strip the release tag from refs
- name: get-release-tag
id: release
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
# Print some info
- name: info
id: info
run: |
echo "TAG: ${{ steps.release.outputs.tag }}"
echo "EVENT: ${{ github.event_name }}"
# Build and push docker image 'latest' to quay.io when the event is a 'push' and branch 'master'
- uses: mr-smithers-excellent/docker-build-push@v5
name: build-push-docker-image-latest
if: ${{ github.event_name == 'push' && steps.release.outputs.tag == 'master' }}
with:
image: ${{ env.ORG_NAME }}/${{ env.APP_NAME }}
tags: master, latest
registry: quay.io
username: ${{ secrets.QUAY_DOCKER_REPO_USERNAME }}
password: ${{ secrets.QUAY_DOCKER_REPO_PASSWORD }}
# Build and push docker release to quay.io when the event is a 'release'
- uses: mr-smithers-excellent/docker-build-push@v5
name: build-push-docker-image-release
if: ${{ github.event_name == 'release' }}
with:
image: ${{ env.ORG_NAME }}/${{ env.APP_NAME }}
tags: ${{ steps.release.outputs.tag }}
registry: quay.io
username: ${{ secrets.QUAY_DOCKER_REPO_USERNAME }}
password: ${{ secrets.QUAY_DOCKER_REPO_PASSWORD }}