forked from lcosmin/boardgamegeek
-
Notifications
You must be signed in to change notification settings - Fork 4
87 lines (74 loc) · 2.05 KB
/
ci.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
name: CI
# 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: [ 'master', 'main' ]
push:
branches: [ 'master', 'main' ]
tags:
- 'v*'
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Run pre-commit
uses: pre-commit/[email protected]
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install tox
run: pip install tox
- name: Run tox
run: tox
- name: Upload coverage to Codecov
if: ${{ github.ref == 'refs/heads/master' }}
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
publish:
runs-on: ubuntu-latest
needs: [linter, test]
if: startsWith(github.ref, 'refs/tags/v')
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel twine
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Build and publish 📦 to PyPI
uses: pypa/[email protected]