-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bug/#298-creating-a-single-GitHub-workflow-f…
…ile-fails-if-directory-.github/workflows-exists-already
- Loading branch information
Showing
17 changed files
with
337 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,14 +40,17 @@ jobs: | |
run: | | ||
poetry run python -m nox -s docs:build | ||
build-matrix: | ||
name: Generate Build Matrix | ||
uses: ./.github/workflows/matrix-python.yml | ||
|
||
Lint: | ||
name: Linting (Python-${{ matrix.python-version }}) | ||
needs: [ Version-Check ] | ||
needs: [ Version-Check, build-matrix ] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | ||
|
||
steps: | ||
- name: SCM Checkout | ||
|
@@ -70,12 +73,11 @@ jobs: | |
|
||
Type-Check: | ||
name: Type Checking (Python-${{ matrix.python-version }}) | ||
needs: [ Version-Check ] | ||
needs: [ Version-Check, build-matrix ] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | ||
|
||
steps: | ||
- name: SCM Checkout | ||
|
@@ -91,12 +93,11 @@ jobs: | |
|
||
Security: | ||
name: Security Checks (Python-${{ matrix.python-version }}) | ||
needs: [ Version-Check ] | ||
needs: [ Version-Check, build-matrix ] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | ||
|
||
steps: | ||
- name: SCM Checkout | ||
|
@@ -134,16 +135,14 @@ jobs: | |
run: poetry run nox -s project:format | ||
|
||
Tests: | ||
name: Unit-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) | ||
needs: [ Documentation, Lint, Type-Check, Security, Format] | ||
name: Unit-Tests (Python-${{ matrix.python-version }}) | ||
needs: [ Documentation, Lint, Type-Check, Security, Format, build-matrix ] | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
exasol-version: [ "7.1.9" ] | ||
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | ||
|
||
steps: | ||
- name: SCM Checkout | ||
|
@@ -155,7 +154,7 @@ jobs: | |
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Run Tests and Collect Coverage | ||
run: poetry run nox -s test:unit -- -- --coverage --db-version ${{ matrix.exasol-version }} | ||
run: poetry run nox -s test:unit -- -- --coverage | ||
|
||
- name: Upload Artifacts | ||
uses: actions/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build Matrix (All Versions) | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
matrix: | ||
description: "Generates the all versions build matrix" | ||
value: ${{ jobs.all_versions.outputs.matrix }} | ||
|
||
jobs: | ||
all_versions: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: SCM Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python & Poetry Environment | ||
uses: ./.github/actions/python-environment | ||
|
||
- name: Generate matrix | ||
run: poetry run nox -s matrix:all | ||
|
||
- id: set-matrix | ||
run: | | ||
echo "matrix=$(poetry run nox -s matrix:all)" >> $GITHUB_OUTPUT | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build Matrix (Exasol) | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
matrix: | ||
description: "Generates the exasol version build matrix" | ||
value: ${{ jobs.exasol_versions.outputs.matrix }} | ||
|
||
jobs: | ||
exasol_versions: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: SCM Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python & Poetry Environment | ||
uses: ./.github/actions/python-environment | ||
|
||
- name: Generate matrix | ||
run: poetry run nox -s matrix:exasol | ||
|
||
- id: set-matrix | ||
run: | | ||
echo "matrix=$(poetry run nox -s matrix:exasol)" >> $GITHUB_OUTPUT | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build Matrix (Python) | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
matrix: | ||
description: "Generates the python version build matrix" | ||
value: ${{ jobs.python_versions.outputs.matrix }} | ||
|
||
jobs: | ||
python_versions: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: SCM Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python & Poetry Environment | ||
uses: ./.github/actions/python-environment | ||
|
||
- name: Generate matrix | ||
run: poetry run nox -s matrix:python | ||
|
||
- id: set-matrix | ||
run: | | ||
echo "matrix=$(poetry run nox -s matrix:python)" >> $GITHUB_OUTPUT | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import json | ||
import logging | ||
|
||
import nox | ||
from nox import Session | ||
|
||
from noxconfig import ( | ||
PROJECT_CONFIG, | ||
Config, | ||
) | ||
|
||
_log = logging.getLogger(__name__) | ||
|
||
_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"] | ||
_EXASOL_VERSIONS = ["7.1.9"] | ||
|
||
|
||
def _python_matrix(config: Config): | ||
attr = "python_versions" | ||
python_versions = getattr(config, attr, _PYTHON_VERSIONS) | ||
if not hasattr(config, attr): | ||
_log.warning( | ||
"Config does not contain '%s' setting. Using default: %s", | ||
attr, | ||
_PYTHON_VERSIONS, | ||
) | ||
return {"python-version": python_versions} | ||
|
||
|
||
def _exasol_matrix(config: Config): | ||
attr = "exasol_versions" | ||
exasol_versions = getattr(config, attr, _EXASOL_VERSIONS) | ||
if not hasattr(config, attr): | ||
_log.warning( | ||
"Config does not contain '%s' setting. Using default: %s", | ||
attr, | ||
_EXASOL_VERSIONS, | ||
) | ||
return {"exasol-version": exasol_versions} | ||
|
||
|
||
@nox.session(name="matrix:python", python=False) | ||
def python_matrix(session: Session) -> None: | ||
"""Output the build matrix for Python versions as JSON.""" | ||
print(json.dumps(_python_matrix(PROJECT_CONFIG))) | ||
|
||
|
||
@nox.session(name="matrix:exasol", python=False) | ||
def exasol_matrix(session: Session) -> None: | ||
"""Output the build matrix for Exasol versions as JSON.""" | ||
print(json.dumps(_exasol_matrix(PROJECT_CONFIG))) | ||
|
||
|
||
@nox.session(name="matrix:all", python=False) | ||
def full_matrix(session: Session) -> None: | ||
"""Output the full build matrix for Python & Exasol versions as JSON.""" | ||
matrix = _python_matrix(PROJECT_CONFIG) | ||
matrix.update(_exasol_matrix(PROJECT_CONFIG)) | ||
print(json.dumps(matrix)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.