-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (52 loc) · 1.77 KB
/
main.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
name: CI
on: [push]
jobs:
build-and-test:
runs-on:
ubuntu-20.04
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build Docker image
run: docker build -t lyrx2sld .
- name: Run
run: docker run -d -p 80:80 lyrx2sld
- name: Set up Python
uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run Python tests
run: pytest tests/tests.py -v
- name: Integration test
run: ./tests/integration_test.sh
publish:
if: ${{ github.ref == 'refs/heads/master' }}
runs-on:
ubuntu-20.04
needs:
build-and-test
env:
PATH: /bin:/usr/bin:/usr/local/bin:/home/runner/.local/bin
SUMMON_PROVIDER: /usr/local/bin/gopass
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build Docker image
run: docker build -t camptocamp/lyrx2sld:latest .
- uses: camptocamp/initialise-gopass-summon-action@v1
with:
ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}}
github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}}
- run: scripts/publish-docker --image=lyrx2sld --tag=latest
- run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
git_branch=${GITHUB_REF#refs/heads/}
docker tag camptocamp/lyrx2sld:latest camptocamp/lyrx2sld:$git_branch.$git_hash
scripts/publish-docker --image=lyrx2sld --tag=$git_branch.$git_hash