-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (80 loc) · 2.43 KB
/
main.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
name: Continuous Integration
# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
tags:
- "v*"
jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip" # caching pip dependencies
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Run tests
run: |
source venv/bin/activate
flake8 --exclude=venv* --statistics --exit-zero
pytest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# Creates a GitHub Release when the test job succeeds, and only on pushes to tags.
release:
needs: [test]
permissions:
contents: write
if: needs.test.result == 'success' && startsWith( github.ref, 'refs/tags/v' )
runs-on: ubuntu-22.04
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install invoke colorama
- name: Get the version
id: get_version
run: |
echo "${{ github.ref }}"
echo "VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\///')" >> $GITHUB_ENV
- name: Generate Release Title
id: get_release_title
shell: bash
run: |
export TODAY="($(TZ=Africa/Lusaka date --iso))"
echo "RELEASE_NAME=$VERSION $TODAY" >> $GITHUB_ENV
- name: Extract Release Notes
# This creates a file LATEST_RELEASE_NOTES.md in the parent directory (../)
shell: bash
run: |
source venv/bin/activate
invoke get-release-notes
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.RELEASE_NAME }}
body_path: ../LATEST_RELEASE_NOTES.md