Skip to content

Commit

Permalink
ci: build docker
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Aug 16, 2024
1 parent 938bcca commit b77f16f
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"github>Trim21/renovate-config",
"github>Trim21/renovate-config:monthly"
]
}
24 changes: 24 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build

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

jobs:
dist-files:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- run: pipx run flit build

- name: Check Files
run: pipx run twine check --strict dist/*
44 changes: 44 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: lint

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

jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip

- run: pip install -e '.[dev]'

- uses: liskin/gh-problem-matcher-wrap@v3
with:
action: add
linters: mypy

- name: mypy
run: mypy --show-column-numbers rtorrent_rpc

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip

- run: pip install -e '.[dev]'

- uses: trim21/actions/pre-commit@master
47 changes: 47 additions & 0 deletions .github/workflows/release-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release(Docker)

on:
push:
tags:
- v*
branches:
- master

jobs:
docker:
runs-on: ubuntu-latest
env:
IMAGE: 'ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}'

concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: false

steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=semver,pattern=v{{version}}
type=ref,event=branch
type=ref,event=branch,suffix=-{{ sha }}
- name: Build Final Docker Image
uses: docker/build-push-action@v6
with:
context: ./
provenance: false
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
67 changes: 67 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: test

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

jobs:
test:
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip

- run: pip install -e '.[dev]'

- name: run tests
run: coverage run -a -m pytest tests

- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required

e2e:
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4
- run: docker compose up -d
working-directory: ./e2e/fixtures

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip

- run: pip install -e '.[dev]'

- run: docker compose ps
working-directory: ./e2e/fixtures

- run: docker compose logs rtorrent-unix
working-directory: ./e2e/fixtures

- run: docker compose logs rtorrent-tcp
working-directory: ./e2e/fixtures

- name: run tests
run: coverage run -a -m pytest e2e

- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required

0 comments on commit b77f16f

Please sign in to comment.