Skip to content

Commit

Permalink
WIP: add to release workflow and update other workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrake committed Sep 27, 2024
1 parent 5e07f51 commit c345b4d
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 94 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/auto_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ jobs:
workflow-auto-updates:
name: Update dependencies and hooks
runs-on: ubuntu-latest
strategy:
matrix:
# It's only one Python version specified in a "matrix", but on purpose to stay DRY
python-version: ["3.12"]
env:
PYTHON_VERSION: "3.12"
POETRY_VERSION: "1.8.3"
defaults:
run:
shell: bash
Expand All @@ -35,20 +34,20 @@ jobs:
git_commit_gpgsign: true

- name: Install poetry
run: pipx install poetry==1.8.3
run: pipx install poetry==${{ env.POETRY_VERSION }}

- name: Configure poetry
run: poetry config virtualenvs.in-project true

- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ env.PYTHON_VERSION }}
cache: 'poetry'

- name: Install the project with poetry
run: |
poetry env use python${{ matrix.python-version }}
poetry env use python${{ env.PYTHON_VERSION }}
poetry check --lock
poetry lock --no-update --no-cache
poetry install --verbose --no-root --sync --with qa
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
DOCKER_BUILDKIT: 1
steps:
- name: Get latest phylum-ci release version
id: get_vers
# The API is called directly here instead of using git commands because the repo is not checked out yet
run: |
REL_VER_WITH_v=$( \
Expand All @@ -62,19 +63,19 @@ jobs:
)
REL_VER_WITHOUT_v="${REL_VER_WITH_v//v/}"
echo "${REL_VER_WITH_v}" "${REL_VER_WITHOUT_v}"
echo "REL_VER_WITH_v=${REL_VER_WITH_v}" >> "${GITHUB_ENV}"
echo "REL_VER_WITHOUT_v=${REL_VER_WITHOUT_v}" >> "${GITHUB_ENV}"
echo "REL_VER_WITH_v=${REL_VER_WITH_v}" >> "${GITHUB_OUTPUT}"
echo "REL_VER_WITHOUT_v=${REL_VER_WITHOUT_v}" >> "${GITHUB_OUTPUT}"
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# This will ensure the checkout matches the tag for the latest release
ref: ${{ env.REL_VER_WITH_v }}
ref: ${{ steps.get_vers.outputs.REL_VER_WITH_v }}

- name: Get phylum wheel from latest release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release download ${{ env.REL_VER_WITH_v }} --pattern '*.whl'
run: gh release download ${{ steps.get_vers.outputs.REL_VER_WITH_v }} --pattern '*.whl'

- name: Build default docker image with latest phylum wheel
run: |
Expand Down Expand Up @@ -112,6 +113,8 @@ jobs:
run: docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io

- name: Create specific docker tags and push them
env:
REL_VER_WITHOUT_v: ${{ steps.get_vers.outputs.REL_VER_WITHOUT_v }}
run: |
CLI_REL_VER=$(docker run --rm phylum-ci phylum --version | sed 's/phylum //')
docker tag phylum-ci "phylumio/phylum-ci:${{ env.REL_VER_WITHOUT_v }}-CLI${CLI_REL_VER}"
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This is a workflow for previewing packages. It can be used for testing before a release to the "production" systems.
# It will automatically create developmental release builds and make them available for all pushes to `main`. There is
# also an ability to manually trigger this workflow, with an additional option to publish the package to TestPyPI.
# also an ability to manually trigger this workflow, with additional options to (1) publish the package to TestPyPI and
# (2) build, test, and make available a Windows standalone binary.
---
name: Preview

Expand All @@ -17,7 +18,7 @@ on:
description: "Create Windows binary"
type: boolean
required: true
default: false
default: true

push:
branches:
Expand Down Expand Up @@ -89,13 +90,12 @@ jobs:
name: dist
path: ./dist/
if-no-files-found: error
retention-days: 7

- name: Publish to TestPyPI
if: inputs.TestPyPI
run: poetry publish --repository testpypi --username __token__ --password ${{ secrets.TESTPYPI_API_TOKEN }}

windows_build:
build_windows:
name: Build Windows standalone binary
if: inputs.CompileWindows
needs: publish_preview
Expand Down Expand Up @@ -168,7 +168,6 @@ jobs:
name: phylum-ci.exe
path: ./build/phylum-ci.exe
if-no-files-found: error
retention-days: 7

- name: Upload compilation report
if: always()
Expand All @@ -177,7 +176,6 @@ jobs:
name: nuitka-compilation-report.xml
path: ./nuitka-compilation-report.xml
if-no-files-found: warn
retention-days: 7

# Nuitka will create a crash report with a static name when there are failures
- name: Upload crash report
Expand All @@ -187,4 +185,3 @@ jobs:
name: nuitka-crash-report.xml
path: ./nuitka-crash-report.xml
if-no-files-found: ignore
retention-days: 7
Loading

0 comments on commit c345b4d

Please sign in to comment.