File tree 5 files changed +127
-129
lines changed
5 files changed +127
-129
lines changed Original file line number Diff line number Diff line change
1
+ name : Build Docker Image
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ image_tag :
7
+ type : string
8
+ required : true
9
+ ghcr_username :
10
+ type : string
11
+ required : true
12
+ ghcr_image_name :
13
+ type : string
14
+ required : true
15
+ secrets :
16
+ ghcr_token :
17
+ required : true
18
+
19
+ jobs :
20
+ build :
21
+ name : Build Docker Image
22
+ runs-on : ubuntu-latest
23
+
24
+ steps :
25
+ - name : Checkout the Repository
26
+ uses : actions/checkout@v4
27
+ with :
28
+ fetch-depth : 0
29
+
30
+ - name : Set up Docker Buildx
31
+ uses : docker/setup-buildx-action@v3
32
+
33
+ - name : Cache Docker Layers
34
+ uses : actions/cache@v4
35
+ with :
36
+ path : /tmp/.buildx-cache
37
+ key : ${{ runner.os }}-buildx-${{ github.sha }}
38
+ restore-keys : |
39
+ ${{ runner.os }}-buildx-
40
+
41
+ - name : Login to GitHub Container Registry
42
+ uses : docker/login-action@v3
43
+ with :
44
+ registry : ghcr.io
45
+ username : ${{ inputs.ghcr_username }}
46
+ password : ${{ secrets.ghcr_token }}
47
+
48
+ - name : Build & Push Docker Image
49
+ id : docker_build
50
+ uses : docker/build-push-action@v6
51
+ env :
52
+ GHCR_IMAGE : ghcr.io/${{ inputs.ghcr_image_name }}
53
+ with :
54
+ context : .
55
+ push : true
56
+ tags : |
57
+ ${{ env.GHCR_IMAGE }}:${{ inputs.image_tag }}
58
+ cache-from : type=local,src=/tmp/.buildx-cache
59
+ cache-to : type=local,dest=/tmp/.buildx-cache
60
+ platforms : linux/amd64,linux/arm64/v8
61
+
62
+ - name : Image Digest
63
+ run : echo ${{ steps.docker_build.outputs.digest }}
Original file line number Diff line number Diff line change
1
+ name : Run Tests
2
+
3
+ on :
4
+ workflow_call :
5
+
6
+ jobs :
7
+ test :
8
+ name : Run Tests
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - name : Checkout the Repository
13
+ uses : actions/checkout@v4
14
+ with :
15
+ fetch-depth : 0
16
+
17
+ - name : Set up Python
18
+ uses : actions/setup-python@v5
19
+ with :
20
+ python-version : 3.12
21
+ cache : pip
22
+
23
+ - name : Install Dependencies
24
+ run : pip install -r requirements.txt
25
+
26
+ - name : Run Tests
27
+ run : pytest test
Original file line number Diff line number Diff line change
1
+ name : On Pull Request
2
+
3
+ on :
4
+ pull_request :
5
+ types :
6
+ - opened
7
+ - edited
8
+ - synchronize
9
+ - reopened
10
+
11
+ jobs :
12
+ test :
13
+ name : Run Tests
14
+ uses : ./.github/workflows/callable-test.yml
Original file line number Diff line number Diff line change
1
+ name : On Push (Main)
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ test :
10
+ name : Run Tests
11
+ uses : ./.github/workflows/callable-test.yml
12
+
13
+ build :
14
+ name : Build Docker Image
15
+ uses : ./.github/workflows/callable-build.yml
16
+ needs :
17
+ - test
18
+ with :
19
+ ghcr_username : ${{ github.actor }}
20
+ ghcr_image_name : ${{ github.repository }}
21
+ image_tag : latest
22
+ secrets :
23
+ ghcr_token : ${{ secrets.GITHUB_TOKEN }}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments