Skip to content

Commit 597777b

Browse files
gygrobotlidijac
andauthored
Add concurrency to workflows (#243)
Co-authored-by: Lidija Coha <lidijac@users.noreply.github.com>
1 parent 06a995a commit 597777b

File tree

2 files changed

+52
-44
lines changed

2 files changed

+52
-44
lines changed

.github/workflows/main.yml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: CI
22

33
on: [push]
44

5+
concurrency:
6+
group: ${{ github.workflow }}${{ github.ref_name != github.event.repository.default_branch && github.ref || github.run_id }}
7+
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}
8+
59
jobs:
610
test:
711
runs-on: ubuntu-latest
@@ -13,32 +17,32 @@ jobs:
1317
IS_COVERAGE_ALLOWED: ${{ secrets.CODACY_PROJECT_TOKEN != '' }}
1418
IS_MASTER_BRANCH: ${{ github.ref == 'refs/heads/master' }}
1519
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python
18-
uses: actions/setup-python@v2
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: Install poetry
22-
uses: abatilo/actions-poetry@v2.0.0
23-
with:
24-
poetry-version: ${{ matrix.poetry-version }}
25-
- name: Install pip dependencies
26-
run: poetry install
27-
- name: Run tests
28-
run: poetry run pytest --cov-report xml --cov=autopr test/ -v
20+
- uses: actions/checkout@v2
21+
- name: Set up Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install poetry
26+
uses: abatilo/actions-poetry@v2.0.0
27+
with:
28+
poetry-version: ${{ matrix.poetry-version }}
29+
- name: Install pip dependencies
30+
run: poetry install
31+
- name: Run tests
32+
run: poetry run pytest --cov-report xml --cov=autopr test/ -v
2933
lint:
3034
runs-on: ubuntu-latest
3135
steps:
32-
- uses: actions/checkout@v2
33-
- name: Set up Python
34-
uses: actions/setup-python@v2
35-
with:
36-
python-version: 3.9
37-
- name: Install poetry
38-
uses: abatilo/actions-poetry@v2.0.0
39-
with:
40-
poetry-version: 1.3.1
41-
- name: Install pip dependencies
42-
run: poetry install
43-
- name: Run pre-commit
44-
run: poetry run pre-commit run --all-files --show-diff-on-failure
36+
- uses: actions/checkout@v2
37+
- name: Set up Python
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: 3.9
41+
- name: Install poetry
42+
uses: abatilo/actions-poetry@v2.0.0
43+
with:
44+
poetry-version: 1.3.1
45+
- name: Install pip dependencies
46+
run: poetry install
47+
- name: Run pre-commit
48+
run: poetry run pre-commit run --all-files --show-diff-on-failure

.github/workflows/publish.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,29 @@ on:
44
release:
55
types: [published]
66

7+
concurrency:
8+
group: ${{ github.workflow }}${{ github.ref_name != github.event.repository.default_branch && github.ref || github.run_id }}
9+
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}
10+
711
jobs:
812
publish:
913
runs-on: ubuntu-latest
1014
steps:
11-
- uses: actions/checkout@master
12-
- uses: actions/setup-python@v1
13-
with:
14-
python-version: 3.9
15-
- name: Install poetry
16-
uses: abatilo/actions-poetry@v2.0.0
17-
with:
18-
poetry-version: 1.3.1
19-
- name: Install pip dependencies
20-
run: poetry install
21-
- name: Package
22-
run: |
23-
poetry build
24-
- name: Publish to PyPI
25-
uses: pypa/gh-action-pypi-publish@v1.8.8
26-
with:
27-
user: __token__
28-
password: ${{ secrets.pypi_token }}
15+
- uses: actions/checkout@master
16+
- uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.9
19+
- name: Install poetry
20+
uses: abatilo/actions-poetry@v2.0.0
21+
with:
22+
poetry-version: 1.3.1
23+
- name: Install pip dependencies
24+
run: poetry install
25+
- name: Package
26+
run: |
27+
poetry build
28+
- name: Publish to PyPI
29+
uses: pypa/gh-action-pypi-publish@v1.8.8
30+
with:
31+
user: __token__
32+
password: ${{ secrets.pypi_token }}

0 commit comments

Comments
 (0)