Skip to content

Commit

Permalink
move subworkflows into actions
Browse files Browse the repository at this point in the history
  • Loading branch information
FoSix committed Oct 18, 2023
1 parent b8fa407 commit 5239d51
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 148 deletions.
40 changes: 40 additions & 0 deletions .github/actions/doc_tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run Docs tests
description: 'Check if documentation is up to date.'

inputs:
python_version:
description: A version of Python to install
type: string
required: true

runs:
using: composite
steps:
- name: install Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
cache: pip

- name: install Poetry
uses: Gr1N/setup-poetry@v8

- name: create Poetry venv
shell: bash
run: |
poetry env use ${{ inputs.python_version }}
poetry install
- name: generate API docs
shell: bash
run: poetry run make documentation

- name: check if documentation needs updating
shell: bash
run: |
if [ "$(git status --porcelain)" ]; then
git status
exit 1
else
exit 0
fi
1 change: 1 addition & 0 deletions .github/actions/sca/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ runs:
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
cache: pip

- name: install Poetry
uses: Gr1N/setup-poetry@v8
Expand Down
41 changes: 41 additions & 0 deletions .github/actions/unit_tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run Unit tests
description: 'Runs Unit tests.'

inputs:
python_version:
description: A version of Python to install
type: string
required: true

runs:
using: composite
steps:
- name: install Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
cache: pip

- name: install Poetry
uses: Gr1N/setup-poetry@v8

- name: create Poetry venv
shell: bash
run: |
poetry env use ${{ inputs.python_version }}
poetry install
- name: run unit tests and coverage
shell: bash
run: poetry run make test_coverage

# requires pull-requests: write permissions when triggered from PRs
- name: Get coverage
if: ${{ github.event_name == 'pull_request' }}
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.95
thresholdNew: 0.90
thresholdModified: 0.95
28 changes: 19 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/discover_python_version

code_format:
name: Formatting and security
name: SCA tests
needs: pyversion
runs-on: ubuntu-latest
steps:
Expand All @@ -44,21 +44,31 @@ jobs:
python_version: ${{ needs.pyversion.outputs.pyversion }}

unit_tests:
name: Unit Tests
name: Unit tests
needs: pyversion
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/sub_unittest.yml
with:
python_version: ${{ needs.pyversion.outputs.pyversion }}
steps:
- name: checkout code
uses: actions/checkout@v4
- name: run SCA tests
uses: ./.github/actions/unit_tests
with:
python_version: ${{ needs.pyversion.outputs.pyversion }}

documentation_check:
name: API documentation
name: Docs tests
needs: pyversion
uses: ./.github/workflows/sub_docs.yml
with:
python_version: ${{ needs.pyversion.outputs.pyversion }}
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: run SCA tests
uses: ./.github/actions/docs_tests
with:
python_version: ${{ needs.pyversion.outputs.pyversion }}

docker_image_test_build:
name: Build Docker image
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/sub_docs.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/sub_format.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/sub_unittest.yml

This file was deleted.

0 comments on commit 5239d51

Please sign in to comment.