-
Notifications
You must be signed in to change notification settings - Fork 8
152 lines (132 loc) · 4.04 KB
/
simod.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Build, Test, Release
on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- 'src/simod/**'
- 'tests/**'
- '.github/workflows/**'
- 'Dockerfile'
pull_request:
branches: [ master ]
paths:
- 'src/simod/**'
- 'tests/**'
- '.github/workflows/**'
- 'Dockerfile'
env:
DOCKERHUB_USERNAME: nokal
DOCKERHUB_REPO: nokal/simod
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 80
outputs:
version: ${{ steps.versioning.outputs.version }}
docker_image: ${{ env.DOCKERHUB_REPO }}:${{ steps.versioning.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get the version
id: versioning
run: |
pip install poetry
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
- name: Build and push to DockerHub
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.DOCKERHUB_REPO }}:latest,${{ env.DOCKERHUB_REPO }}:${{ steps.versioning.outputs.version }}
file: Dockerfile
context: .
platforms: linux/amd64,linux/arm64
test:
needs: [ build ]
runs-on: ubuntu-latest
container:
image: ${{ needs.build.outputs.docker_image }}
env:
BRANCH_NAME: master
steps:
- name: Testing
shell: bash
run: |
Xvfb :99 &>/dev/null & disown
cd /usr/src/Simod
poetry install
poetry run pytest --cov=. --cov-report=xml --durations=0 -v -x -k "not test_build_fuzzy_calendars" -m "not benchmark"
- name: PyLint
shell: bash
run: |
cd /usr/src/Simod
poetry run pylint -j 0 --exit-zero src/simod > pylint.txt
- name: Upload PyLint output
uses: actions/upload-artifact@v3
with:
name: pylint.txt
path: /usr/src/Simod/pylint.txt
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
env_vars: OS,PYTHON
fail_ci_if_error: false
name: codecov-umbrella
verbose: true
release:
needs: [ test ]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.versioning.outputs.version }}
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install poetry
run: pip install poetry
- name: Generate licenses.md
run: |
poetry run pip install pip-licenses
poetry run pip-licenses --with-system --with-urls --format=markdown --output-file=licenses.md
- name: Upload licenses.md
uses: actions/upload-artifact@v3
with:
name: licenses.md
path: licenses.md
- name: Generate changelog
run: |
echo "# Changelog" > CHANGELOG.md
echo "" >> CHANGELOG.md
echo "\`\`\`" >> CHANGELOG.md
git log --pretty=format:"%h - %s (%an)" $(git describe --tags --abbrev=0)..HEAD >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "\`\`\`" >> CHANGELOG.md
- name: Get the version
id: versioning
run: echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
- name: Assign a version tag
run: |
git tag ${{ steps.versioning.outputs.version }}
git push --tags
- name: Create a release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*
tag_name: ${{ steps.versioning.outputs.version }}
body_path: CHANGELOG.md