Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust CI configuration #187

Merged
merged 14 commits into from
Jan 27, 2024
26 changes: 24 additions & 2 deletions .github/workflows/_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

Expand All @@ -35,6 +35,28 @@ jobs:
python -m pip install --upgrade pip
python -m pip install build

- name: Check git status (not Windows)
if: runner.os != 'Windows'
run: |
if [[ -z "$(git status --porcelain)" ]]; then
echo "No changes found."
else
echo "Changes detected. Please commit or discard changes before publishing."
git status --porcelain
exit 1
fi

- name: Check git status (Windows)
if: runner.os == 'Windows'
run: |
if (-not (git status --porcelain)) {
Write-Output "No changes found."
} else {
Write-Output "Changes detected. Please commit or discard changes before publishing."
git status --porcelain
exit 1
}

- name: Build the package
run: python -m build --outdir .

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_build_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/_codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: python
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -42,7 +42,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -55,6 +55,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:python"
4 changes: 2 additions & 2 deletions .github/workflows/_pre_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
Pre-Commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.0
14 changes: 12 additions & 2 deletions .github/workflows/_pypi_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # IMPORTANT: otherwise the current tag does not get fetched and the build version gets worse

- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11

Expand All @@ -42,6 +42,16 @@ jobs:
python -m pip install --upgrade pip
python -m pip install build

- name: Check git status
run: |
if [[ -z "$(git status --porcelain)" ]]; then
echo "No changes found."
else
echo "Changes detected. Please commit or discard changes before publishing."
git status --porcelain
exit 1
fi

- name: Build the package
run: python -m build .

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_test_futures_private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_test_futures_public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_test_spot_private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_test_spot_public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

Expand Down
81 changes: 43 additions & 38 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
Expand All @@ -100,27 +100,27 @@ jobs:
## (public endpoints)
##
Test-Spot-Public:
needs: [Build]
needs: [Pre-Commit]
uses: ./.github/workflows/_test_spot_public.yaml
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
##
## (private endpoints)
Test-Spot-Private:
needs: [Build]
needs: [Pre-Commit]
uses: ./.github/workflows/_test_spot_private.yaml
strategy:
max-parallel: 1 # to avoid failing tests because of API Rate limits
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
Expand All @@ -131,48 +131,68 @@ jobs:
##
## (public endpoints)
Test-Futures-Public:
needs: [Build]
needs: [Pre-Commit]
uses: ./.github/workflows/_test_futures_public.yaml
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
##
## (private endpoints)
Test-Futures-Private:
needs: [Build]
needs: [Pre-Commit]
uses: ./.github/workflows/_test_futures_private.yaml
strategy:
max-parallel: 1 # to avoid failing tests because of API Rate limits
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
secrets: inherit

## ===========================================================================
## Uploads the package to test.pypi.org on master if triggered by
## a regular commit/push.
## Generates and uploads the coverage statistics to codecov
##
UploadTestPyPI:
CodeCov:
if: |
success() &&
github.actor == 'btschwertfeger' &&
github.ref == 'refs/heads/master' &&
github.event_name == 'push'
(success() && github.actor == 'btschwertfeger')
&& (github.event_name == 'push' || github.event_name == 'release')
needs:
- Test-Spot-Public
- Test-Spot-Private
- Test-Futures-Public
- Test-Futures-Private
name: Upload current development version to Test PyPI
uses: ./.github/workflows/_codecov.yaml
with:
os: "ubuntu-latest"
python-version: "3.11"
secrets: inherit

## ===========================================================================
## Uploads the package to test.pypi.org on master if triggered by
## a regular commit/push.
##
UploadTestPyPI:
if: |
(
success()
&& github.actor == 'btschwertfeger'
&& github.ref == 'refs/heads/master'
)
&& (github.event_name == 'push' || github.event_name == 'release')
needs:
- Build
- Build-Doc
- CodeQL
- CodeCov
name: Upload development version to Test PyPI
uses: ./.github/workflows/_pypi_publish.yaml
with:
REPOSITORY_URL: https://test.pypi.org/legacy/
Expand All @@ -187,29 +207,14 @@ jobs:
success() &&
github.actor == 'btschwertfeger' &&
github.event_name == 'release'
needs: [UploadTestPyPI]
name: Upload the current release to PyPI
needs:
- Build
- Build-Doc
- CodeQL
- CodeCov
name: Upload release to PyPI
uses: ./.github/workflows/_pypi_publish.yaml
with:
REPOSITORY_URL: https://upload.pypi.org/legacy/
secrets:
API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

## ===========================================================================
## Generates and uploads the coverage statistics to codecov
##
CodeCov:
if: |
success() &&
github.actor == 'btschwertfeger' &&
github.event_name == 'push'
needs:
- Test-Spot-Public
- Test-Spot-Private
- Test-Futures-Public
- Test-Futures-Private
uses: ./.github/workflows/_codecov.yaml
with:
os: "ubuntu-latest"
python-version: "3.11"
secrets: inherit
13 changes: 0 additions & 13 deletions .github/workflows/codeql.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/manual_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
4 changes: 2 additions & 2 deletions .github/workflows/manual_test_futures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
Expand All @@ -46,7 +46,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
Expand Down
Loading
Loading