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
42 changes: 42 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "04:24"
target-branch: main
labels:
- CI/CD
- skip-changelog
groups:
actions:
applies-to: "version-updates"
patterns:
- "*"
actions-security:
applies-to: "security-updates"
patterns:
- "*"

- package-ecosystem: pip
directories:
- "/"
- "/.github/utils"
schedule:
interval: weekly
time: "04:16"
target-branch: main
labels:
- dependencies
- skip-changelog
groups:
python:
applies-to: "version-updates"
patterns:
- "*"
python-security:
applies-to: "security-updates"
patterns:
- "*"
2 changes: 2 additions & 0 deletions .github/utils/requirements_ci.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pip-tools~=7.5
pre-commit~=4.6
68 changes: 68 additions & 0 deletions .github/workflows/cd_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CD - Release

on:
release:
types: [published]

jobs:
build:
name: External
uses: SINTEF/ci-cd/.github/workflows/cd_release.yml@v2.10.0
if: github.repository == 'SemanticMatter/httpx2_auth' && startsWith(github.ref, 'refs/tags/v')

permissions:
contents: write

with:
# General
git_username: ${{ vars.CI_CD_GIT_USER }}
git_email: ${{ vars.CI_CD_GIT_EMAIL }}
release_branch: main

# Python package
python_package: true
package_dirs: httpx2_auth
install_extras: "[dev]"
pip_index_url: "${{ vars.EXTERNAL_PYPI_INDEX_URL }}"
python_version_build: "3.10"
build_libs: build
build_cmd: "python -m build"
build_dir: "dist"
changelog_exclude_labels: skip-changelog,duplicate,question,invalid,wontfix
publish_on_pypi: false
upload_distribution: true
version_update_changes_separator: ","
version_update_changes: |
{package_dir}/__init__.py,__version__ *= *(?:'|\").*(?:'|\"),__version__ = \"{version}\"
.github/workflows/ci_tests.yml,dist/httpx2_auth-2\.[0-9]+\.[0-9]+\.[0-9]+,dist/httpx2_auth-{version}

# Documentation
update_docs: false

secrets:
PAT: ${{ secrets.BOT_PAT }}

publish:
name: Publish to SINTEF GitLab
needs: build
runs-on: ubuntu-latest

environment:
name: GitLab
url: ${{ vars.GITLAB_PACKAGE_URL }}

steps:
- name: Download distribution
uses: actions/download-artifact@v8
with:
name: dist # The artifact will always be called 'dist'
path: dist

- name: Publish to SemanticMatter @ SINTEF GitLab
uses: pypa/gh-action-pypi-publish@release/v1
with:
# The path to the distribution to upload
packages-dir: dist
repository-url: ${{ vars.GITLAB_PACKAGE_REGISTRY_URL }}
user: ${{ secrets.DEPLOY_TOKEN_USERNAME }}
password: ${{ secrets.DEPLOY_TOKEN_PASSWORD }}
13 changes: 13 additions & 0 deletions .github/workflows/ci_automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CI - Activate auto-merging

on:
pull_request_target:
branches: [main]

jobs:
update-dependabot-branch:
name: External
uses: SINTEF/ci-cd/.github/workflows/ci_automerge_prs.yml@v2.10.0
if: github.repository_owner == 'SemanticMatter' && ( ( startsWith(github.event.pull_request.head.ref, 'dependabot/') && github.actor == 'dependabot[bot]' ) || ( github.event.pull_request.head.ref == 'pre-commit-ci-update-config' && github.actor == 'pre-commit-ci[bot]' ) )
secrets:
PAT: ${{ secrets.BOT_PAT }}
120 changes: 120 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: CI - Tests

on:
pull_request:
push:
branches:
- master
- 'push-action/**' # Allow pushing to protected branches (using CasperWA/push-protected)

env:
PIP_INDEX_URL: "${{ vars.EXTERNAL_PYPI_INDEX_URL }}"

jobs:
pre-commit_audit:
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6

- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -U -r .github/utils/requirements_ci.txt

- name: Run pre-commit
# Ensure pip-audit is also run - if pre-commit fails, pip-audit will still run
# If pre-commit fails (but pip-audit does not), the job will fail from the last step
continue-on-error: true
id: pre_commit
run: pre-commit run --all-files

- name: Create requirements.txt file for pip-audit
run: pip-compile --index-url="${{ env.PIP_INDEX_URL }}" --output-file="${{ runner.temp }}/requirements.txt" --all-extras --verbose --color "${{ github.workspace }}/pyproject.toml"

- name: Run pip-audit
uses: pypa/gh-action-pip-audit@v1.1.0
with:
extra-index-urls: ${{ env.PIP_INDEX_URL }}
no-deps: true
inputs: ${{ runner.temp }}/requirements.txt

- name: Fail if pre-commit failed
if: steps.pre_commit.outcome == 'failure'
run: |
echo "❌ pre-commit run failed (see step 'Run pre-commit' above for details)"
exit 1

pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']

steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -U -e .[testing]

- name: Run pytest
run: pytest -vv --color=yes --doctest-modules --cov-report=xml ./tests

- name: Upload coverage
if: github.repository_owner == 'SemanticMatter'
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
env_vars: PYTHON
flags: local
env:
PYTHON: ${{ matrix.python-version }}

build:
runs-on: ubuntu-latest

steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6

- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -U build

- name: Build package
run: |
python -m build .
rm -Rf httpx2_auth

- name: Install wheel
run: |
python -m pip install dist/httpx2_auth-2.0.1.0-py3-none-any.whl --force-reinstall
python -c 'import httpx2_auth'

- name: Install source distribution
run: |
python -m pip install dist/httpx2_auth-2.0.1.0.tar.gz --force-reinstall
python -c 'import httpx2_auth'
26 changes: 0 additions & 26 deletions .github/workflows/release.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/test.yml

This file was deleted.

Loading