diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml new file mode 100644 index 0000000..0f11d9b --- /dev/null +++ b/.github/workflows/PR.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 23956d9..8968b28 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -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 @@ -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/* diff --git a/.github/workflows/code_formatting.yml b/.github/workflows/code_formatting.yml index 2d5f965..caa30f8 100644 --- a/.github/workflows/code_formatting.yml +++ b/.github/workflows/code_formatting.yml @@ -3,8 +3,10 @@ # SPDX-License-Identifier: Apache-2.0 name: Code formatting + on: - - push + workflow_call: + jobs: Black: runs-on: ubuntu-latest @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..29d65b0 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index 7c2b12d..110ed7d 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -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 }} diff --git a/.github/workflows/pydocstyle_check.yml b/.github/workflows/pydocstyle_check.yml index 336a187..fb4c362 100644 --- a/.github/workflows/pydocstyle_check.yml +++ b/.github/workflows/pydocstyle_check.yml @@ -3,8 +3,10 @@ # SPDX-License-Identifier: Apache-2.0 name: pydocstyle + on: - - push + workflow_call: + jobs: pydocstyle: runs-on: ubuntu-latest @@ -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 diff --git a/.github/workflows/pylint_check.yml b/.github/workflows/pylint_check.yml index 845db8c..0ce6980 100644 --- a/.github/workflows/pylint_check.yml +++ b/.github/workflows/pylint_check.yml @@ -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) @@ -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 @@ -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 diff --git a/.github/workflows/release_tagging.yml b/.github/workflows/release_tagging.yml index aaa0358..7764ccc 100644 --- a/.github/workflows/release_tagging.yml +++ b/.github/workflows/release_tagging.yml @@ -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" @@ -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) diff --git a/.github/workflows/reuse_compliance.yml b/.github/workflows/reuse_compliance.yml index dc08574..0e50374 100644 --- a/.github/workflows/reuse_compliance.yml +++ b/.github/workflows/reuse_compliance.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index f641956..964ccf0 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -3,8 +3,10 @@ # SPDX-License-Identifier: Apache-2.0 name: Run Pytest + on: - - push + workflow_call: + jobs: Build: runs-on: ubuntu-latest @@ -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 @@ -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 diff --git a/.github/workflows/sonarcloud_analysis.yml b/.github/workflows/sonarcloud_analysis.yml new file mode 100644 index 0000000..14a2f57 --- /dev/null +++ b/.github/workflows/sonarcloud_analysis.yml @@ -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 diff --git a/LICENSE.txt b/LICENSE.md similarity index 100% rename from LICENSE.txt rename to LICENSE.md diff --git a/README.md b/README.md index e113b44..3ab2ac7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,23 @@ SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Right SPDX-License-Identifier: Apache-2.0 --> +