Add CI/CD workflow for cleanmedia
- Adds a GitHub Actions workflow for linting, testing, and deployment. - Uses `uv` for environment management and dependency installation. - Configures Ruff, Mypy, and Pytest for code quality and testing. - Implements Docker Buildx for building and pushing to GHCR. - Adds a CI badge to the README. - Deploys to GHCR only on pushes to the master branch.
This commit is contained in:
parent
aa1c2fe69e
commit
f940b7a8ad
62
.github/workflows/ci.yml
vendored
Normal file
62
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
name: CI + Deploy to GHCR
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Lint with Ruff & Mypy
|
||||
run: |
|
||||
uv venv .venv
|
||||
source .venv/bin/activate
|
||||
uv run ruff check
|
||||
uv run ruff format --check
|
||||
uv run mypy .
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
uv venv .venv
|
||||
source .venv/bin/activate
|
||||
uv run pytest -v --cov=. --cov-report=xml
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
if: github.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
run: echo "${{ secrets.REPOSITORY_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push to GHCR
|
||||
run: |
|
||||
docker buildx build --push \
|
||||
--tag ghcr.io/${{ github.repository_owner }}/cleanmedia:latest \
|
||||
.
|
@ -1,5 +1,6 @@
|
||||
# Cleanmedia
|
||||
[](https://codecov.io/gl/rogs/cleanmedia)
|
||||
[](https://git.rogs.me/rogs/cleanmedia/actions)
|
||||
|
||||
<p align="center">
|
||||
<img src="https://gitlab.com/uploads/-/system/project/avatar/64971838/logo.png" alt="cleanmedia"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user