-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (57 loc) · 2.05 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
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.12.1'
architecture: 'x64'
- name: Update pip, wheel, and setuptools
run: pip install -U pip wheel setuptools
- name: Setup the virtual environment
run: |
python -m venv .venv
source .venv/bin/activate
- name: Install dependencies
run: pip install -e .[dev]
- name: Run flake8
run: flake8 src tests
- name: Run tests
run: |
dbversion=$(createdb --version)
pgversion=$(python -c "import re; print(re.compile(r'createdb \(\S+\ ([^\.]+)').match('${dbversion}').groups()[0])")
export PATH=/usr/lib/postgresql/$pgversion/bin:$PATH
which pg_ctl
which createdb
which pg_config
coverage run -m pytest
coverage report -m
- name: Update Coverage Badge
# GitHub actions: default branch variable
# https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: tj-actions/coverage-badge-py@v2
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: coverage.svg
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add coverage.svg
git commit -m "Updated coverage.svg"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.github_token }}
branch: ${{ github.ref }}