-
Notifications
You must be signed in to change notification settings - Fork 100
165 lines (140 loc) · 4.84 KB
/
behave.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
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Test Councils
on:
workflow_dispatch:
push:
# Trigger unless only the wiki directory changed
paths-ignore:
- "wiki/**"
- "**/**.md"
- "uk_bin_collection_api_server/**"
branches: [ "master" ]
pull_request:
# Trigger unless only the wiki directory changed
paths-ignore:
- "wiki/**"
- "**/**.md"
- "uk_bin_collection_api_server/**"
branches: [ "master" ]
schedule:
- cron: '0 0 * * *'
jobs:
build:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12]
poetry-version: [1.8.3]
services:
selenium:
image: selenium/standalone-chrome:latest
options: --shm-size=2gb --name selenium --hostname selenium
ports:
- 4444:4444
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==${{ matrix.poetry-version }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
#cache: 'poetry'
- name: Install
run: make install
- name: Lint JSON
run: jq empty uk_bin_collection/tests/input.json
- name: Check Parity of Councils / input.json / Feature file
run: |
repo=${{ github.event.pull_request.head.repo.full_name || 'robbrad/UKBinCollectionData' }}
branch=${{ github.event.pull_request.head.ref || 'master' }}
make parity-check repo=$repo branch=$branch
- name: Get all councils files that have changed
id: changed-council-files
uses: tj-actions/changed-files@v45
with:
files: |
uk_bin_collection/uk_bin_collection/councils/**.py
- name: Get all councils
env:
ALL_CHANGED_FILES: ${{ steps.changed-council-files.outputs.all_changed_files }}
run: |
IFS=' ' read -ra FILES <<< "$ALL_CHANGED_FILES"
COUNCIL_TESTS=""
for file in "${FILES[@]}"; do
FILENAME=$(basename "$file" .py)
if [ -z "$COUNCIL_TESTS" ]; then
COUNCIL_TESTS="$FILENAME"
else
COUNCIL_TESTS="$COUNCIL_TESTS or $FILENAME"
fi
done
echo "COUNCIL_TESTS=${COUNCIL_TESTS}" >> $GITHUB_ENV
- name: Run integration tests
env:
HEADLESS: True
run: make matrix=${{ matrix.python-version }} councils="${{ env.COUNCIL_TESTS }}" integration-tests
continue-on-error: true
- name: Run unit tests
run: make unit-tests
continue-on-error: true
#- name: Upload test coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# gcov_ignore: uk_bin_collection/tests/**
- name: Upload test results to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
- name: Get Allure history
uses: actions/checkout@v4
if: github.ref == 'refs/heads/master'
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Allure report action from marketplace
uses: simple-elf/allure-report-action@master
if: github.ref == 'refs/heads/master'
with:
allure_results: build/${{ matrix.python-version }}/allure-results
subfolder: ${{ matrix.python-version }}
allure_history: allure-history
keep_reports: 20
- name: Tar report
if: github.ref == 'refs/heads/master'
run: tar -cvf allure_history_${{ matrix.python-version }}.tar allure-history/${{ matrix.python-version }}
- name: Upload artifact
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/master'
with:
name: allure_history_${{ matrix.python-version }}
path: allure_history_${{ matrix.python-version }}.tar
deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v4
name: Download 3.11 artifacts
with:
name: allure_history_3.11
path: allure-history/tars
- uses: actions/download-artifact@v4
name: Download 3.12 artifacts
with:
name: allure_history_3.12
path: allure-history/tars
- name: Untar reports
run: for i in allure-history/tars/*.tar; do tar -xvf "$i" allure-history ;done
- name: Remove tar reports
run: rm -rf allure-history/tars
- name: Display structure of downloaded files
run: ls -R
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history