Skip to content

Commit 9b70ff7

Browse files
author
Rafał Safin
committed
add dependabot and update workflows
Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl>
1 parent a6bd5dc commit 9b70ff7

File tree

6 files changed

+132
-48
lines changed

6 files changed

+132
-48
lines changed

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
allow:
9+
- dependency-type: "all"
10+
groups:
11+
all-dependencies:
12+
patterns:
13+
- "*"
14+
exclude-patterns:
15+
- "pytest-asyncio"
16+
17+
- package-ecosystem: github-actions
18+
directory: /
19+
schedule:
20+
interval: weekly
21+
22+
- package-ecosystem: docker
23+
directory: /
24+
schedule:
25+
interval: weekly

.github/workflows/dev_build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: dev-build
2+
on:
3+
workflow_run:
4+
workflows: ["tests"]
5+
branches: [main]
6+
types:
7+
- completed
8+
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: "Docker image tag"
13+
required: true
14+
default: "latest"
15+
16+
env:
17+
IMAGE_TAG: ${{ github.event.inputs.tag || 'latest' }}
18+
19+
jobs:
20+
dev_build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Login to DockerHub
26+
uses: docker/login-action@v3
27+
with:
28+
username: ${{ secrets.DOCKER_USER }}
29+
password: ${{ secrets.DOCKER_PASS }}
30+
31+
- name: Build and push image
32+
uses: docker/build-push-action@v5
33+
with:
34+
file: Dockerfile
35+
push: true
36+
tags: rafsaf/minimal-fastapi-postgres-template:${{ env.IMAGE_TAG }}

.github/workflows/manual_build_docker_image.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: Run tests
2-
1+
name: tests
32
on:
43
push:
4+
branches:
5+
- "**"
6+
tags-ignore:
7+
- "*.*"
58

69
jobs:
7-
build:
8-
runs-on: ubuntu-20.04
10+
tests:
11+
runs-on: ubuntu-latest
912
services:
1013
postgres:
1114
image: postgres
@@ -17,35 +20,37 @@ jobs:
1720
--health-timeout 5s
1821
--health-retries 5
1922
ports:
20-
- 31234:5432
23+
- 5432:5432
2124
steps:
22-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2326

2427
- name: Set up Python
25-
uses: actions/setup-python@v2
28+
uses: actions/setup-python@v5
2629
with:
27-
python-version: "3.12"
30+
python-version: "3.12.2"
2831

2932
- name: Install Poetry
3033
uses: snok/install-poetry@v1
3134
with:
3235
virtualenvs-create: true
33-
virtualenvs-in-project: true
36+
virtualenvs-in-project: false
37+
virtualenvs-path: /opt/venv
3438

3539
- name: Load cached venv
3640
id: cached-poetry-dependencies
37-
uses: actions/cache@v2
41+
uses: actions/cache@v4
3842
with:
39-
path: .venv
40-
key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
43+
path: /opt/venv
44+
key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }}
4145

42-
- name: Run poetry install
46+
- name: Install dependencies and actiavte virtualenv
4347
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
4448
run: |
4549
poetry install --no-interaction --no-root
4650
4751
- name: Run tests
4852
env:
53+
SECURITY__JWT_SECRET_KEY: very-not-secret
4954
DATABASE__HOSTNAME: localhost
5055
DATABASE__PASSWORD: postgres
5156
run: |

.github/workflows/type_check.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: type-check
2+
on:
3+
push:
4+
branches:
5+
- "**"
6+
tags-ignore:
7+
- "*.*"
8+
9+
jobs:
10+
type_check:
11+
strategy:
12+
matrix:
13+
check: ["ruff check", "mypy --check", "ruff format --check"]
14+
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12.2"
23+
24+
- name: Install Poetry
25+
uses: snok/install-poetry@v1
26+
with:
27+
virtualenvs-create: true
28+
virtualenvs-in-project: true
29+
30+
- name: Install Poetry
31+
uses: snok/install-poetry@v1
32+
with:
33+
virtualenvs-create: true
34+
virtualenvs-in-project: false
35+
virtualenvs-path: /opt/venv
36+
37+
- name: Load cached venv
38+
id: cached-poetry-dependencies
39+
uses: actions/cache@v4
40+
with:
41+
path: /opt/venv
42+
key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }}
43+
44+
- name: Install dependencies and actiavte virtualenv
45+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
46+
run: |
47+
poetry install --no-interaction --no-root
48+
49+
- name: Run ${{ matrix.check }}
50+
run: |
51+
poetry run ${{ matrix.check }} .

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM python:3.12.1-slim-bullseye as base
1+
FROM python:3.12.2-slim-bullseye as base
22

33
ENV PYTHONUNBUFFERED 1
44
WORKDIR /build
55

66
# Create requirements.txt file
77
FROM base as poetry
8-
RUN pip install poetry==1.7.1
8+
RUN pip install poetry==1.8.2
99
COPY poetry.lock pyproject.toml ./
1010
RUN poetry export -o /requirements.txt --without-hashes
1111

0 commit comments

Comments
 (0)