Skip to content

Commit 84d6d80

Browse files
committed
👷 CI
1 parent 2ebb43d commit 84d6d80

File tree

4 files changed

+68
-26
lines changed

4 files changed

+68
-26
lines changed

.github/workflows/CI-CD.yaml

+65-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,75 @@
1-
name: CI/CD
2-
1+
#file: noinspection SpellCheckingInspection
32
on:
43
push:
54
branches: [ "main", "dev" ]
5+
# Publish semver tags as releases.
66
tags: [ 'v*.*.*' ]
77
pull_request:
8-
branches: [ "dev" ]
8+
branches: ["dev"]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
913

1014
jobs:
1115
tests:
12-
uses: ./.github/workflows/tests.yaml
13-
16+
name: Run tests
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Setup PDM
21+
uses: pdm-project/setup-pdm@v4
22+
with:
23+
cache: true
24+
- name: Install dependencies
25+
run: pdm install -d
26+
- name: Run linting check
27+
run: pdm run lint --check
28+
- name: Run tests
29+
run: pdm run tests
30+
- name: Export requirements
31+
run: pdm run export
32+
- name: Check for changes
33+
if: contains(github.actor, 'renovate[bot]') == false
34+
run: git diff --exit-code HEAD requirements.txt
1435
docker:
1536
needs: tests
16-
uses: ./.github/workflows/docker.yaml
17-
secrets: inherit
37+
runs-on: ubuntu-latest
38+
permissions:
39+
contents: read
40+
packages: write
41+
id-token: write
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/[email protected]
48+
49+
- name: Log into registry ${{ env.REGISTRY }}
50+
uses: docker/[email protected]
51+
with:
52+
registry: ${{ env.REGISTRY }}
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Extract Docker metadata for
57+
id: meta
58+
uses: docker/[email protected]
59+
with:
60+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
61+
tags: |
62+
type=ref,event=branch
63+
type=ref,event=pr
64+
type=ref,event=tag
65+
type=sha
66+
67+
- name: Build and push Docker image
68+
uses: docker/[email protected]
69+
with:
70+
context: .
71+
push: true
72+
tags: ${{ steps.meta.outputs.tags }}
73+
labels: ${{ steps.meta.outputs.labels }}
74+
cache-from: type=gha
75+
cache-to: type=gha,mode=max

.github/workflows/docker.yaml

-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
name: Build and Push Docker Image
2-
3-
on:
4-
push:
5-
branches: [ "main", "dev" ]
6-
tags: [ 'v*.*.*' ]
7-
pull_request:
8-
branches: ["dev"]
9-
10-
env:
11-
REGISTRY: ghcr.io
12-
IMAGE_NAME: ${{ github.repository }}
13-
142
jobs:
153
docker:
164
runs-on: ubuntu-latest

.github/workflows/test.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
name: Run Tests
2-
3-
on:
4-
workflow_call:
5-
62
jobs:
73
run-tests:
84
runs-on: ubuntu-latest

.github/workflows/update_dependencies.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
uses: pdm-project/setup-pdm@v4
1818
with:
1919
cache: true
20-
- name: Update dependencies
21-
run: pdm update
20+
- name: Install dependencies
21+
run: pdm lock
2222
- name: Export requirements
23-
run: pdm export -o requirements.txt
23+
run: pdm run export
2424
- name: Check for changes
2525
id: git-check
2626
run: |

0 commit comments

Comments
 (0)