-
Notifications
You must be signed in to change notification settings - Fork 123
73 lines (71 loc) · 2.26 KB
/
alns.yaml
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
name: ALNS
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip and poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Get current time
uses: josStorer/get-current-time@v2.0.2
id: current-time
- name: Cache Python dependencies
uses: actions/cache@v3
id: cache-python
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ steps.current-time.outputs.year }}-${{ steps.current-time.outputs.month }}
- name: Install Python dependencies
if: steps.cache-python.outputs.cache-hit != 'true'
run: poetry install
- name: Cache pre-commit
uses: actions/cache@v3
id: cache-pre-commit
with:
path: ~/.cache/pre-commit/
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
if: steps.cache-pre-commit.outputs.cache-hit != 'true'
run: poetry run pre-commit install --install-hooks
- name: Run pytest
run: poetry run pytest
- name: Run pre-commit
run: poetry run pre-commit run --all-files
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
deploy:
needs: build
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Update pip and poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Deploy to PyPI
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry build
poetry publish