-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (86 loc) · 2.48 KB
/
docker-ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Docker-ci
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
docker-build-ci:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# mariadb service for testing
services:
db:
image: mariadb
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: geheim
MYSQL_DATABASE: dbTest
MYSQL_USER: mysqluser
MYSQL_PASSWORD: mysqlpassword
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log into registry ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Install Mariadb-Client on Runner for tests
run: |
# install MariaDB client
sudo apt-get update
sudo apt-get install mariadb-client
- name: Test
env:
HBCI_PINFILE: ${{ secrets.HBCI_PINFILE }}
run: |
[ "$RUNNER_DEBUG" == 1 ] &&
DEBUGSH="set -x" &&
TESTPARM="--debug" &&
set -x
cat >.hbci-pinfile <<<"$HBCI_PINFILE"
MYSQL_HOST=db
MYSQL_LOCAL_HOST=127.0.0.1
MYSQL_DATABASE=dbTest
MYSQL_USER=mysqluser
MYSQL_PASSWORD=mysqlpassword
MYSQL_ROOT_PASSWORD=geheim
FINIMG="${{ steps.meta.outputs.tags}}"
FINNET="${{ job.services.db.network}}"
. ./testlocal.sh test $TESTPARM
- name: Cleanup Test
if: always()
run: |
rm .hbci-pinfile
- name: Push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max