Skip to content

v3.0.12

v3.0.12 #160

Workflow file for this run

name: CI/CD Pipeline
'on':
pull_request:
push:
tags: ['v*']
env:
LATEST_PYTHON_VERSION: '3.14'
jobs:
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/ruff-action@v3
with:
args: "check"
test:
name: Unit Tests
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
run: uv python install ${{ env.LATEST_PYTHON_VERSION }}
- name: Install dependencies
run: uv sync --locked --all-extras --all-groups
- name: Run tests with coverage
uses: nick-fields/retry@v3
with:
timeout_minutes: 2
max_attempts: 3
command: uv run --no-sync coverage run -m pytest tests/unit && uv run --no-sync coverage report && uv run --no-sync coverage xml
shell: bash
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
- name: Upload test results to Codecov
uses: codecov/codecov-action@v5
with:
report_type: test_results
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
run: uv python install ${{ env.LATEST_PYTHON_VERSION }}
- name: Install dependencies
run: uv sync --locked --all-extras --all-groups
- name: Run integration tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 3
max_attempts: 3
command: uv run --no-sync pytest tests/integration
shell: bash
docker:
name: Docker
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v6
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
config: .hadolint.yml
- name: Validate compose file
run: |
cp .env.example .env
docker compose -f docker-compose.yml config --quiet
- name: Build base image
run: docker build --target python-base -t discordbot-ci-test .
- name: Smoke test - Python available
run: |
VERSION=$(docker run --rm discordbot-ci-test python --version)
echo "$VERSION"
echo "$VERSION" | grep -q "${{ env.LATEST_PYTHON_VERSION }}"
- name: Smoke test - uv available
run: docker run --rm discordbot-ci-test uv --version
pages:
name: Deploy Pages
runs-on: ubuntu-latest
needs: [test, integration-test, docker]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- name: Prepare docs from README
run: |
{
echo '---'
echo 'layout: default'
echo '---'
echo ''
} > docs/index.md
awk '{if (/^\|/ && prev != "" && prev !~ /^\|/) print ""; print; prev=$0}' README.md >> docs/index.md
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: docs/
destination: ./_site
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
release:
name: Create Release
runs-on: ubuntu-latest
needs: [test, integration-test, docker]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true