Skip to content
Merged
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
35 changes: 35 additions & 0 deletions .github/actions/uv-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup UV and Sync
description: 'Install uv and sync the dependencies'
inputs:
sync:
description: 'Whether to run `uv sync` after setting up.'
required: false
default: 'true'
type: boolean
dev:
description: 'Whether to use `--no-dev` with `uv sync`.'
required: false
default: 'true'
type: boolean
activate-environment:
description: 'Wether to activate the virtual env or not'
required: false
default: true
type: boolean
runs:
using: 'composite'
steps:
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
version: "0.7.x"
activate-environment: ${{ inputs.activate-environment }}
- if: inputs.sync == 'true' && inputs.dev == 'false'
run: uv sync --frozen --no-dev
shell: bash
env:
FORCE_COLOR: "1"
- if: inputs.sync == 'true' && inputs.dev == 'true'
run: uv sync --frozen
shell: bash
env:
FORCE_COLOR: "1"
48 changes: 48 additions & 0 deletions .github/workflows/code-checkers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Static code checkers

on:
push:
branches:
- 'master'
pull_request:

permissions: {}

jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/uv-setup/
- run: mypy --install-types --non-interactive .

pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/uv-setup/
- run: pyright

ruff:
runs-on: ubuntu-latest
env:
FORCE_COLOR: "1"
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/uv-setup/
- run: ruff check

flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/uv-setup/
- run: flake8
41 changes: 28 additions & 13 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
name: Build and Push Docker Image to GHCR

on: push
on:
push:
branches:
- 'master'
pull_request:

permissions:
contents: read # Required to checkout the repo code
packages: write # Required to push packages to GHCR
permissions: {}

jobs:
xcp-ng-build-env-82:
runs-on: ubuntu-latest
permissions:
packages: write # Required to push packages to GHCR
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
with:
persist-credentials: false
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
with:
driver: docker-container
- uses: docker/login-action@v3
- uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
if: github.ref == 'refs/heads/master'
with:
registry: ghcr.io
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
- uses: docker/build-push-action@v5 # Using v5 for latest features
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
context: ./src/xcp_ng_dev/
file: ./src/xcp_ng_dev/files/Dockerfile-8.x
Expand All @@ -35,18 +41,23 @@ jobs:

xcp-ng-build-env-83:
runs-on: ubuntu-latest
permissions:
packages: write # Required to push packages to GHCR
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
with:
persist-credentials: false
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
with:
driver: docker-container
- uses: docker/login-action@v3
- uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
if: github.ref == 'refs/heads/master'
with:
registry: ghcr.io
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
- uses: docker/build-push-action@v5 # Using v5 for latest features
- run: echo "VERSION=$(cat ./src/xcp_ng_dev/files/protocol-version.txt | tr -d '\n')" >> $GITHUB_ENV
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
context: ./src/xcp_ng_dev/
file: ./src/xcp_ng_dev/files/Dockerfile-8.x
Expand All @@ -60,18 +71,22 @@ jobs:
# TODO: uncomment once we have a public xcp-ng 9.0 repository
# xcp-ng-build-env-90:
# runs-on: ubuntu-latest
# permissions:
# packages: write # Required to push packages to GHCR
# steps:
# - uses: actions/checkout@v4
# - uses: docker/setup-buildx-action@v3
# with:
# persist-credentials: false
# - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
# with:
# driver: docker-container
# - uses: docker/login-action@v3
# - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
# if: github.ref == 'refs/heads/master'
# with:
# registry: ghcr.io
# username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
# password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
# - uses: docker/build-push-action@v5 # Using v5 for latest features
# - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
# with:
# context: ./src/xcp_ng_dev/
# file: ./src/xcp_ng_dev/files/Dockerfile-9.x
Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/format.yaml

This file was deleted.

23 changes: 11 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ on:
- 'master'
pull_request:

permissions: {}

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.7.x"
- name: Install dependencies
run: uv sync --frozen
- name: Test
# use script to provide a tty (workaround of systematic "docker -t"?)
shell: 'script -q -e -c "bash {0}"'
run: |
uv run ./test/test.sh
- uses: actions/checkout@v4
with:
persist-credentials: true # required for git lfs
- uses: ./.github/actions/uv-setup/
- name: Test
# use script to provide a tty (workaround of systematic "docker -t"?)
shell: 'script -q -e -c "bash {0}"'
run: |
./test/test.sh
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Create a release from tag

permissions: {}

on:
push:
tags:
- '*'

jobs:
build:
name: Build and store python artifacts
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

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

- name: Build
run: uv build

- name: Store python distribution artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist/

release:
permissions:
contents: write # allow creating a release

name: "Create and package a release"
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Retrieve distribution artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: dist/

- name: Create release ${{ github.ref_name }}
shell: bash
run: |
gh release create ${GITHUB_REF_NAME} --repo ${{ github.repository }} --generate-notes dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/requirements-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check requirements file consistency

on:
push:
branches:
- 'master'
pull_request:

permissions: {}

jobs:
requirements-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/uv-setup/
with:
dev: false
- run: ./requirements/update_requirements.py
- run: git diff --exit-code
24 changes: 24 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: GitHub Actions Security Analysis with zizmor 🌈

on:
push:
branches:
- 'master'
pull_request:

permissions: {}

jobs:
zizmor:
name: zizmor latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/uv-setup/
with:
sync: false
- run: uvx zizmor --color=always .
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.11
Loading