Skip to content

Commit

Permalink
Merge branch 'main' into rtd-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau committed Dec 17, 2024
2 parents 11f8c9e + e84fd12 commit 1cdebeb
Show file tree
Hide file tree
Showing 74 changed files with 6,110 additions and 2,663 deletions.
12 changes: 12 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GitHub CODEOWNERS. See:
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
# Remember, the last match takes precedence.

# Global owner, used as a last resort.
* @lengau

# Documentation owners
/docs/ @medubelko @lengau

# Finally, all CODEOWNERS changes need to be approved by The Man, Himself.
/.github/CODEOWNERS @sergiusens
16 changes: 0 additions & 16 deletions .github/workflows/cla-check.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Security scan
name: Check policy
on:
pull_request:
push:
branches:
- main
- hotfix/*
- work/secscan # For development
- work/check-policy # For development

jobs:
policy:
uses: canonical/starflow/.github/workflows/policy.yaml@main
python-scans:
name: Scan Python project
name: Security scan
uses: canonical/starflow/.github/workflows/scan-python.yaml@main
with:
packages: python-apt-dev
Expand All @@ -18,3 +20,4 @@ jobs:
# contain vulnerable versions.
requirements-find-args: '! -name requirements-noble.txt ! -path "./tests/spread/*"'
osv-extra-args: '--config=source/osv-scanner.toml'
uv-export: false
25 changes: 25 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: QA
on:
push:
branches:
- "main"
- "feature/*"
- "hotfix/*"
- "release/*"
- "renovate/*"
pull_request:
merge_group:

jobs:
lint:
uses: canonical/starflow/.github/workflows/lint-python.yaml@main
test:
uses: canonical/starflow/.github/workflows/test-python.yaml@main
with:
# Self-hosted Jammy and Noble runners, GH-hosted macos and Windows runners.
# Limiting to amd64 is a workaround for https://github.com/canonical/charmcraft/issues/2018
fast-test-platforms: '[["jammy", "amd64"], ["noble", "amd64"], "macos-13", "macos-14-large", "windows-2019", "windows-2022"]'
# Slow tests run on noble to avoid an issue with old skopeo versions.
slow-test-platforms: '["noble", "macos-14-large"]'
# Switch to just noble when we fix #2018
lowest-python-platform: self-hosted-linux-amd64-noble-large
31 changes: 9 additions & 22 deletions .github/workflows/spread-large.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,19 @@ on:

workflow_dispatch:

# If we're editing this file, run it on the pull request.
pull_request:
paths:
- .github/workflows/spread-large.yaml

# Only ever run one of this test at a time.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
snap-build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build snap
uses: snapcore/action-build@v1
id: charmcraft
- name: Upload snap artifact
uses: actions/upload-artifact@v4
with:
name: snap
path: ${{ steps.charmcraft.outputs.snap }}

pack-charm:
spread:
runs-on: spread-installed
needs: [snap-build]
strategy:
fail-fast: false
# Each of these tasks can spin up several machines in spread.
Expand All @@ -54,10 +42,9 @@ jobs:
with:
fetch-depth: 0
submodules: true
- name: Download snap artifact
uses: actions/download-artifact@v4
with:
name: snap
- name: Download charmcraft snap
run: |
snap download --channel=latest/edge charmcraft
- name: Spread k8s operator
env:
LAUNCHPAD_TOKEN: ${{ secrets.LAUNCHPAD_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
snap-build:
runs-on: ubuntu-22.04
runs-on: [self-hosted, amd64]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
137 changes: 18 additions & 119 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,117 +13,8 @@ on:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Begin snap installs
run: |
echo "Installing snaps in the background while running apt and pip..."
sudo snap install --no-wait shellcheck ruff
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Configure environment
run: |
echo "::group::pip install"
python -m pip install tox
echo "::endgroup::"
echo "::group::Create virtual environments for linting processes."
tox run -m lint --notest
echo "::endgroup::"
echo "::group::Wait for snap to complete"
snap watch --last=install
echo "::endgroup::"
- name: Run Linters
run: tox run --skip-pkg-install --no-list-dependencies -m lint
run-tests:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04, macos-12, macos-13, windows-2019, windows-2022]
include:
- os: windows-2019
python-version: |
3.11
3.12
- os: windows-2022
python-version: |
3.11
3.12
- os: macos-12
python_version: |
3.10
3.12
- os: macos-13
python_version: |
3.10
3.12
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
if: ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Ubuntu-specific dependencies
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install -y python3-pip python3-setuptools python3-wheel python3-venv libapt-pkg-dev
pipx install poetry
# Jammy runners have too old a version of pip.
if [[ $(lsb_release --codename --short) == 'jammy' ]]; then
python3 -m pip install -U pip
fi
- name: Setup LXD
uses: canonical/[email protected]
if: ${{ runner.os == 'Linux' }}
- name: Install skopeo (mac)
# This is only necessary for Linux until skopeo >= 1.11 is in repos.
# Once we're running on Noble, we can get skopeo from apt.
if: ${{ runner.os == 'macOS' }}
run: |
brew install skopeo
- name: Install skopeo (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
if [[ $(cat /etc/os-release | grep VERSION_CODENAME) == 'VERSION_CODENAME=jammy' ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install skopeo
sudo rm -f /bin/skopeo
sudo ln -s $(which skopeo) /bin/skopeo
else
sudo apt install skopeo
fi
# Allow skopeo to access the contents of /run/containers
sudo chmod 777 /run/containers
# Add an xdg runtime dir for skopeo to look into for an auth.json file
sudo mkdir -p /run/user/$(id -u)
sudo chown $USER /run/user/$(id -u)
- name: Configure environment
run: |
pipx install tox
tox run --colored yes -m tests --notest
- name: Run tests
shell: bash
run: |
if [[ $(uname --kernel-name) == "Linux" ]]; then
export XDG_RUNTIME_DIR=/run/user/$(id -u)
fi
tox run --skip-pkg-install --no-list-dependencies --result-json results/tox-${{ matrix.platform }}.json --colored yes -m tests
snap-build:
runs-on: ubuntu-22.04
runs-on: [self-hosted, amd64]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -235,17 +126,18 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
- name: Set up uv with caching
id: setup-uv
uses: astral-sh/setup-uv@v3
with:
python-version: '3.11'
enable-cache: true
- name: Install dependencies
run: |
pip install -U pyinstaller -r requirements.txt
pip install .
uv sync --no-dev
uv pip install pyinstaller
- name: Build
run: |
pyinstaller charmcraft.spec
uv run pyinstaller charmcraft.spec
- name: Upload unsigned exe
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -296,7 +188,7 @@ jobs:
macos-smoke-test:
strategy:
matrix:
os: [macos-12, macos-13]
os: [macos-13, macos-14-large]
runs-on: ${{ matrix.os }}
steps:
# Installing and caching homebrew using the action should speed up subsequent CI:
Expand All @@ -314,26 +206,33 @@ jobs:
- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems
- name: Install Multipass
- name: Install dependencies with homebrew
run: |
brew install multipass
brew install [email protected] # For building pygit2
- name: Checkout code
uses: actions/checkout@v4
- name: Set up uv with caching
id: setup-uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Build and install Charmcraft
run: |
pipx install .
uv sync --no-dev
- name: Check for fully-configured multipass
run: |
while ! multipass version; do
sleep 1
done
- name: Init and pack
run: |
source .venv/bin/activate
mkdir test-charm
cd test-charm
export CRAFT_VERBOSITY_LEVEL=trace
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ docs/_build/
# Auto-generated command reference
/docs/reference/commands/
/docs/reference/_autosummary/
/docs/common/craft-parts

# PyBuilder
target/
Expand Down Expand Up @@ -145,3 +146,6 @@ dmypy.json

# Spread files
.spread-reuse*.yaml

# `snapcraft try` can be very useful
/prime/
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-toml
- id: fix-byte-order-marker
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.1"
hooks:
# Run the linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format
- repo: https://github.com/adrienverge/yamllint.git
rev: "v1.35.1"
hooks:
- id: yamllint
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ build:
python: "3.10"
jobs:
post_checkout:
- git fetch --tags --depth 1 # Also fetch tags
- git describe --always # Useful for debugging
- git fetch --tags --depth 1 # Also fetch tags
- git describe --always # Useful for debugging

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
Loading

0 comments on commit 1cdebeb

Please sign in to comment.