Skip to content

Commit

Permalink
Merge pull request #4 from sede-open/initial_repo_updates
Browse files Browse the repository at this point in the history
Initial repo updates
  • Loading branch information
bvandekerkhof authored Feb 19, 2024
2 parents 6a07df9 + b90e783 commit bd30c0f
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 48 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: PullRequest

on:
pull_request:
types: [opened, synchronize, reopened, review_requested]
branches:
- main

jobs:
CodeFormat:
uses: sede-open/pyELQ/.github/workflows/code_formatting.yml@main
secrets: inherit

Pydocstyle:
uses: sede-open/pyELQ/.github/workflows/pydocstyle_check.yml@main
needs: CodeFormat

Pylint:
uses: sede-open/pyELQ/.github/workflows/pylint_check.yml@main
needs: Pydocstyle

Tests:
uses: sede-open/pyELQ/.github/workflows/run_tests.yml@main
needs: CodeFormat

SonarCloud:
uses: sede-open/pyELQ/.github/workflows/sonarcloud_analysis.yml@main
needs: Tests
secrets: inherit
16 changes: 10 additions & 6 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# SPDX-License-Identifier: Apache-2.0

name: Building the package

on:
push:
branches:
- 'main'
workflow_call:

jobs:
Build:
runs-on: ubuntu-latest
Expand All @@ -15,20 +15,24 @@ jobs:
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build
pip install --upgrade twine
- name: Build the package
run: |
python -m build
- name: Upload build files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pyelq_whl
path: ./dist/*.whl
- name: Upload build files
run: |
twine upload --username __token__ --password ${{ secrets.PYPI_TOKEN }} --verbose dist/*
8 changes: 5 additions & 3 deletions .github/workflows/code_formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# SPDX-License-Identifier: Apache-2.0

name: Code formatting

on:
- push
workflow_call:

jobs:
Black:
runs-on: ubuntu-latest
Expand All @@ -14,9 +16,9 @@ jobs:
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: Main

on:
push:
branches:
- main

jobs:
CodeFormat:
uses: sede-open/pyELQ/.github/workflows/code_formatting.yml@main
secrets: inherit

Pydocstyle:
uses: sede-open/pyELQ/.github/workflows/pydocstyle_check.yml@main
needs: CodeFormat

Pylint:
uses: sede-open/pyELQ/.github/workflows/pylint_check.yml@main
needs: Pydocstyle

Tests:
uses: sede-open/pyELQ/.github/workflows/run_tests.yml@main
needs: CodeFormat

SonarCloud:
uses: sede-open/pyELQ/.github/workflows/sonarcloud_analysis.yml@main
needs: Tests
secrets: inherit

ReleaseTag:
uses: sede-open/pyELQ/.github/workflows/release_tagging.yml@main
needs: [CodeFormat, Pydocstyle, Pylint, Tests]
secrets: inherit

Build:
uses: sede-open/pyELQ/.github/workflows/build_package.yml@main
needs: ReleaseTag
secrets: inherit

PublishDocs:
uses: sede-open/pyELQ/.github/workflows/publish_docs.yml@main
needs: Build
12 changes: 6 additions & 6 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# SPDX-License-Identifier: Apache-2.0

name: publish documentation

on:
push:
branches:
- main
workflow_call:

permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: 3.11
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/pydocstyle_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# SPDX-License-Identifier: Apache-2.0

name: pydocstyle

on:
- push
workflow_call:

jobs:
pydocstyle:
runs-on: ubuntu-latest
Expand All @@ -14,9 +16,9 @@ jobs:
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/pylint_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#
# SPDX-License-Identifier: Apache-2.0

name: Pylint Check

on:
- push
workflow_call:

name: Pylint Check
jobs:
Pylint:
# Specify the operating system GitHub has to use to perform the checks (ubuntu seems to be default)
Expand All @@ -15,9 +16,9 @@ jobs:
# Specify all python versions you might want to perform the actions on
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -30,7 +31,7 @@ jobs:
run: |
python -m pylint `find -regextype egrep -regex '(.*src/pyelq/.*.py)$'` --output-format=parseable:pylint_report.out
- name: Upload pylint results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pylint_report
path: pylint_report.out
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/release_tagging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@

name: ReleaseTag

# Trigger when a python file is changed on main branch either from pull request or push
# but not when only pyproject.toml is changed due to version bump
on:
push:
branches:
- 'main'
paths:
- '**.py'
- '!pyproject.toml'
- 'requirements.txt'
workflow_call:

jobs:
# Releases new Python version when Pull Requests are merged into "main"
Expand All @@ -26,16 +18,16 @@ jobs:
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Bump version and commit bumped version back to branch
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.PYELQ_TOKEN
GITHUB_ACCESS_TOKEN: ${{ secrets.PYELQ_TOKEN }}
id: version
run: |
version=$(python .github/bump_version.py)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reuse_compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
name: REUSE Compliance Check

on:
- push
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v2
17 changes: 11 additions & 6 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# SPDX-License-Identifier: Apache-2.0

name: Run Pytest

on:
- push
workflow_call:

jobs:
Build:
runs-on: ubuntu-latest
Expand All @@ -13,15 +15,18 @@ jobs:
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install pytest==7.4.4
pip install pytest-cov
pip install .
- name: Unit test with pytest
Expand All @@ -36,13 +41,13 @@ jobs:
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload coverage xml results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage_xml
path: coverage.xml
if: ${{ always() }}
- name: Upload coverage junitxml results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pytest_junitxml
path: pytest_junit.xml
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/sonarcloud_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: SonarCloudAnalysis

on:
workflow_call:

jobs:
SonarCloudAnalysis:
runs-on: ubuntu-latest
strategy:
matrix:
# Specify all python versions you might want to perform the actions on
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.PYELQ_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload SonarCloud Scan Report
uses: actions/upload-artifact@v4
with:
name: sonar-scan-log
path: .scannerwork/report-task.txt
File renamed without changes.
Loading

0 comments on commit bd30c0f

Please sign in to comment.