Skip to content

Commit

Permalink
BUILD: minor tweaks to the release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
j-ittner committed Jun 21, 2024
1 parent f52b09a commit e5a5928
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/artkit-release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
# We check out the result of the trigger action, i.e., either the merge commit
# from a pull request or the commit from a direct push to the target branch
ref: ${{ github.ref }}
# We fetch the last two commits to ensure we have the base branch's history
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -135,8 +137,8 @@ jobs:
unit_tests:
# Run unit tests on the codebase, in developer mode
runs-on: ubuntu-latest
needs: detect_build_config_changes
if: ${{ needs.detect_build_config_changes.outputs.conda_build_config_changed == '1' }}
# We only run the unit tests once the code quality checks have passed
needs: code_quality_checks
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -336,14 +338,18 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.build-system }}_${{ matrix.pkg-dependencies }}
name: "${{ matrix.build-system }}_${{ matrix.pkg-dependencies }}"
path: ${{ env.DIRNAME_WORKSPACE }}/dist

veracode_check:
# Run Veracode static code analysis on the codebase.
# We only do this when the code quality checks have passed and the pipeline is
# preparing or executing a release.
runs-on: ubuntu-latest
needs:
- code_quality_checks
- check_release
# IF (PR from dev/ to release/) OR (push into release/) OR (scheduled run)
if: startsWith(github.head_ref, 'dev/') || startsWith(github.ref, 'refs/heads/release/') || github.event_name == 'schedule'

steps:
Expand Down Expand Up @@ -416,6 +422,8 @@ jobs:
python -m pip install toml~=0.10.2 packaging~=20.9
cd ${{ github.workspace }}/artkit
python <<EOF
import re
from os import environ
from make import ToxBuilder
Expand All @@ -425,15 +433,20 @@ jobs:
assert (branch.startswith("release/") or branch.startswith("dev/") or branch=="1.0.x"
), "This check should only run on versioned branches – check pipeline."
if branch=="1.0.x":
branch_version = branch[:-2]
# check if branch is a main branch with pattern \d.\d.x; if so, extract the major and minor version number
main_branch = re.match(r"(\d+.\d+.)x", branch)
if main_branch:
branch_version = main_branch.group(1)
package_version = ToxBuilder("${{ env.project_name }}", "default").package_version
assert package_version.startswith(branch_version), f"Package version '{package_version}' does not match '{branch_version}' from branch."
assert (
package_version.startswith(branch_version),
f"Package version '{package_version}' does not match '{branch_version}' from branch."
)
else:
branch_version = branch.split("/", maxsplit=1)[1]
package_version = ToxBuilder("${{ env.project_name }}", "default").package_version
assert (
package_version == branch_version
package_version == branch_version
), f"Package version '{package_version}' does not match '{branch_version}' from branch."
print("Check passed.")
Expand Down Expand Up @@ -538,7 +551,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
release_name: ${{ env.project_name }} ${{ env.current_version }}
release_name: "${{ env.project_name }} ${{ env.current_version }}"
body: |
This is the ${{ env.current_version }} release of ${{ env.package_name }}.
Expand Down

0 comments on commit e5a5928

Please sign in to comment.