Skip to content

Commit 1ec811a

Browse files
committed
ci: test
1 parent 794d4de commit 1ec811a

File tree

18 files changed

+421
-447
lines changed

18 files changed

+421
-447
lines changed

.github/actions/bandit/action.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Run Bandit
2+
description: ""
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- run: poetry run bandit -r ${{ github.workspace }}/compyle -c pyproject.toml
8+
shell: bash

.github/actions/cache/action.yaml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,29 @@ inputs:
66
description: "Python version to use for restoring and saving the cache"
77
default: '3.10'
88
poetry-version:
9-
description: "Poetry version to use for restoring and saving the cache"
10-
default: '>=1.3.2'
11-
9+
description: "Poetry minimal version to use for restoring and saving the cache"
10+
default: '1.3.2'
11+
1212
runs:
1313
using: composite
1414
steps:
15-
- uses: actions/checkout@v3.0.2
15+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
1616

17-
- name: Cache poetry virtualenv
18-
id: cache
19-
uses: actions/[email protected]
20-
with:
21-
path: .venv
22-
key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
23-
24-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
25-
name: Install poetry
17+
- name: Install poetry ${{ inputs.poetry-version }}
2618
shell: bash
27-
run: pipx install poetry${{ inputs.poetry-version }}
19+
run: pipx install poetry>=${{ inputs.poetry-version }}
2820

29-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
30-
name: Set up python
21+
- name: Set up python ${{ inputs.python-version }}
3122
uses: actions/setup-python@v4
3223
with:
3324
python-version: ${{ inputs.python-version }}
3425
cache: 'poetry'
35-
36-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
37-
name: Install project dependencies
26+
cache-dependency-path: poetry.lock
27+
28+
- name: Install project dependencies
3829
shell: bash
3930
run: |
31+
poetry env use ${{ inputs.python-version }}
4032
poetry config virtualenvs.in-project true
4133
poetry config virtualenvs.create true
4234
poetry install --no-root --no-interaction --no-ansi --without dev

.github/actions/cache/x.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/actions/pylama/action.yaml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
1-
# name: Run Pylama
2-
# description: ""
3-
# runs:
4-
# using: composite
5-
# steps:
6-
# - run: poetry run pylama
7-
# shell: bash
8-
9-
# let's write the same thing but it now takes the cache from the previous step
10-
# and uses it to run pylama
11-
121
name: Run Pylama
132
description: ""
3+
144
runs:
155
using: composite
166
steps:
17-
- uses: actions/[email protected]
18-
with:
19-
path: .venv
20-
key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
21-
- run: poetry run pylama
7+
- run: poetry run pylama ${{ github.workspace }}/compyle -o pyproject.toml
228
shell: bash
239

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Run python semantic release
2+
description: ""
3+
4+
inputs:
5+
github-token:
6+
description: "GitHub API token to publish GitHub releases"
7+
default: ${{ github.token }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- run: |
13+
poetry run semantic-release changelog --post
14+
poetry run semantic-release version
15+
shell: bash
16+
env:
17+
GH_TOKEN: ${{ inputs.github_token }}

.github/workflows/.github-ci.yaml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,64 @@ on:
88
pull_request:
99
branches:
1010
- '**'
11-
11+
1212
jobs:
1313
dependencies:
1414
name: Install Dependencies
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3.0.2
17+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
1818
- uses: ./.github/actions/cache
1919

2020
quality:
2121
name: Quality
2222
needs: [dependencies]
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/[email protected]
25+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
26+
- uses: ./.github/actions/cache
27+
- uses: ./.github/actions/bandit
2628
- uses: ./.github/actions/pylama
27-
# - uses: ./.github/actions/bandit
28-
29+
30+
test:
31+
name: Test
32+
needs: [dependencies]
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
36+
- uses: ./.github/actions/cache
37+
- uses: ./.github/actions/coverage
38+
39+
release:
40+
name: Release
41+
runs-on: ubuntu-latest
42+
concurrency: release
43+
needs: [dependencies] # TODO quality
44+
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && !contains(github.event.head_commit.message, 'chore(release):')
45+
steps:
46+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
47+
with:
48+
fetch-depth: 0
49+
- uses: ./.github/actions/cache
50+
- uses: ./.github/actions/semantic-release
51+
with:
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
54+
55+
# - name: Configure git
56+
# run: |
57+
# git config user.name github-actions
58+
# git config user.email
59+
60+
# - name: Run python semantic release
61+
# run: |
62+
# poetry run semantic-release changelog --post
63+
# poetry run semantic-release version
64+
65+
# - name: Publish semver
66+
# run: poetry run semantic-release publish
67+
68+
# env:
69+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
# # PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
71+
# # semantic

.github/workflows/common/.bandit.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/common/.pylama.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/common/.release.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
default_stages: [commit]
22
default_language_version:
3-
node: "16.16.0"
3+
node: "18.12.0"
44
python: "python3.10"
55

66
exclude: '.vscode/'
@@ -22,6 +22,7 @@ repos:
2222
hooks:
2323
- id: pylama
2424
args:
25+
- --option=pyproject.toml
2526
- --max-line-length=120
2627
additional_dependencies: [toml, mypy, eradicate, pydocstyle==6.1.1]
2728

0 commit comments

Comments
 (0)