Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions cookiecutter-pypackage/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build

on:
workflow_call:
inputs:
vpu_docker_registry:
required: true
type: string
vpu_docker_image_name:
required: true
type: string
vpu_docker_repositories:
required: true
type: string
build_name:
required: true
type: string
build_number:
required: true
type: string

jobs:
build-python:
runs-on: ubuntu-latest
env:
COLUMNS: 160
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: astral-sh/setup-uv@v7

- name: Sync project
run: uv sync --frozen

- name: Build docs
run: uv run tox run -e docs

- name: Build python app
run: uv run tox run -e build

- name: Upload python artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/*

- name: Upload docs
uses: actions/upload-artifact@v7
with:
name: docs
path: docs/build/html/*

build-docker:
needs:
- build-python
runs-on: ubuntu-latest
env:
VPU_DOCKER_REGISTRY: ${{ inputs.vpu_docker_registry }}
VPU_DOCKER_IMAGE_NAME: ${{ inputs.vpu_docker_image_name }}
VPU_DOCKER_REPOSITORIES: ${{ inputs.vpu_docker_repositories }}
COLUMNS: 160
JFROG_CLI_BUILD_NAME: ${{ inputs.build_name }}
JFROG_CLI_BUILD_NUMBER: ${{ inputs.build_number }}
JFROG_CLI_TEMP_DIR: ${{ github.workspace }}/.jfrog-build"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: ./.github/actions/setup-jfrog

- uses: astral-sh/setup-uv@v7

- name: Install VPU
run: uv tool install voraus-pipeline-utils

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Download python artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist

- name: Build Docker Image(s)
run: vpu docker build -f Dockerfile.prod

- name: Save Docker Image(s)
run: vpu docker save --output docker-images.tar

- name: Upload docker images
uses: actions/upload-artifact@v7
with:
name: docker-images
path: docker-images.tar

17 changes: 17 additions & 0 deletions cookiecutter-pypackage/.github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Linting

on: [workflow_call]

jobs:
lint-python:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: astral-sh/setup-uv@v7

- name: Run static checks
run: uv run tox run -e lint
69 changes: 69 additions & 0 deletions cookiecutter-pypackage/.github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI pipeline

permissions:
contents: write
id-token: write
issues: write
pages: write

on:
pull_request:
branches:
- main
push:
branches:
- "main"
tags:
- "*"

jobs:
setup:
uses: ./.github/workflows/setup.yml
with:
package_name: 'cookiecutter-pypackage'
project: 'bypass'
scope: 'private'
maturity: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'production' || 'testing' }}
location: 'cloud'
registry: 'voraus.jfrog.io'

build:
needs:
- setup
uses: ./.github/workflows/build.yml
secrets: inherit
with:
vpu_docker_registry: ${{ needs.setup.outputs.vpu_docker_registry }}
vpu_docker_image_name: ${{ needs.setup.outputs.vpu_docker_image_name }}
vpu_docker_repositories: ${{ needs.setup.outputs.vpu_docker_repositories }}
build_name: ${{ needs.setup.outputs.build_name }}
build_number: ${{ needs.setup.outputs.build_number }}

tests-and-coverage:
uses: ./.github/workflows/tests_and_coverage.yml
needs:
- build
secrets: inherit

lint:
uses: ./.github/workflows/lint.yml
needs:
- setup
secrets: inherit

publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- setup
- build
- tests-and-coverage
- lint
uses: ./.github/workflows/publish.yml
secrets: inherit
with:
vpu_docker_registry: ${{ needs.setup.outputs.vpu_docker_registry }}
vpu_docker_image_name: ${{ needs.setup.outputs.vpu_docker_image_name }}
vpu_docker_repositories: ${{ needs.setup.outputs.vpu_docker_repositories }}
pypi_deploy_repo: ${{ needs.setup.outputs.pypi_deploy_repo }}
build_name: ${{ needs.setup.outputs.build_name }}
build_number: ${{ needs.setup.outputs.build_number }}
186 changes: 186 additions & 0 deletions cookiecutter-pypackage/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: Publish

on:
workflow_call:
inputs:
vpu_docker_registry:
required: true
type: string
vpu_docker_image_name:
required: true
type: string
vpu_docker_repositories:
required: true
type: string
pypi_deploy_repo:
required: true
type: string
build_name:
required: true
type: string
build_number:
required: true
type: string

jobs:
publish-pypi:
runs-on: ubuntu-latest
env:
JFROG_CLI_BUILD_NAME: ${{ inputs.build_name }}
JFROG_CLI_BUILD_NUMBER: ${{ inputs.build_number }}
JFROG_CLI_TEMP_DIR: ${{ github.workspace }}/.jfrog-build
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: ./.github/actions/setup-jfrog

- name: Add Git info to build
run: jf rt build-add-git

- uses: astral-sh/setup-uv@v7

- name: Install twine
run: uv tool install twine

- name: Configure jf pip
run: jf pip-config --repo-resolve pypi --repo-deploy ${{ inputs.pypi_deploy_repo }}

- name: Download python artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist

- name: Publish PyPI
run: jf twine --module=voraus-pipeline-playground upload dist/*

- name: Upload build info partials
if: success()
uses: actions/upload-artifact@v7
with:
name: build-partials-${{ github.job }}
path: ${{ env.JFROG_CLI_TEMP_DIR }}
include-hidden-files: true
if-no-files-found: error

publish-docker:
runs-on: ubuntu-latest
env:
VPU_DOCKER_REGISTRY: ${{ inputs.vpu_docker_registry }}
VPU_DOCKER_IMAGE_NAME: ${{ inputs.vpu_docker_image_name }}
VPU_DOCKER_REPOSITORIES: ${{ inputs.vpu_docker_repositories }}
COLUMNS: 160
JFROG_CLI_BUILD_NAME: ${{ inputs.build_name }}
JFROG_CLI_BUILD_NUMBER: ${{ inputs.build_number }}
JFROG_CLI_TEMP_DIR: ${{ github.workspace }}/.jfrog-build"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: ./.github/actions/setup-jfrog

- name: Add Git info to build
run: jf rt build-add-git

- uses: astral-sh/setup-uv@v7

- name: Install VPU
run: uv tool install voraus-pipeline-utils

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Download all artifacts
uses: actions/download-artifact@v8
with:
name: docker-images

- name: Load docker images
run: docker load -i docker-images.tar

- name: Publish Docker Image(s)
run: vpu docker push

- name: Upload build info partials
if: success()
uses: actions/upload-artifact@v7
with:
name: build-partials-${{ github.job }}
path: ${{ env.JFROG_CLI_TEMP_DIR }}
include-hidden-files: true
if-no-files-found: error

publish-build-info:
needs:
- publish-pypi
- publish-docker
runs-on: ubuntu-latest
env:
JFROG_CLI_BUILD_NAME: ${{ inputs.build_name }}
JFROG_CLI_BUILD_NUMBER: ${{ inputs.build_number }}
JFROG_CLI_TEMP_DIR: ${{ github.workspace }}/.jfrog-build
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: ./.github/actions/setup-jfrog

- name: Add environment and git information to build info
run: |
jf rt build-collect-env
jf rt build-add-git

- name: Download build info partials
uses: actions/download-artifact@v8
with:
pattern: build-partials-*
path: ${{ env.JFROG_CLI_TEMP_DIR }}
merge-multiple: true

- name: Publish unified build info
run: jf rt build-publish

create-github-release:
runs-on: ubuntu-latest
needs:
- publish-pypi
- publish-docker
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Run JReleaser
uses: jreleaser/release-action@v2
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_PROJECT_VERSION: ${{ github.ref_name }}

publish-docs:
runs-on: ubuntu-latest
needs:
- publish-pypi
- publish-docker
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
name: docs
path: docs

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading