-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
103 lines (98 loc) · 3.83 KB
/
action.yml
File metadata and controls
103 lines (98 loc) · 3.83 KB
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: 'MariaDB Node.js Test Setup'
description: 'Setup MariaDB/MySQL, certificates, and dependencies for testing'
inputs:
db-type:
description: 'Database type (community, enterprise, dev, mysql)'
required: true
db-tag:
description: 'Database version tag'
required: true
test-db-password:
description: 'Database root password'
required: true
test-db-database:
description: 'Test database name'
required: true
test-db-port:
description: 'Database port'
required: true
default: '3306'
additional-conf:
description: 'Additional database configuration'
required: false
registry-user:
description: 'Enterprise registry user'
required: false
registry-password:
description: 'Enterprise registry password'
required: false
os:
description: 'Operating system'
required: true
init-script-folder:
description: 'initialized directory'
required: false
outputs:
database-type:
description: 'Type of database that was setup'
value: ${{ steps.mariadb-install.outputs.database-type }}
runs:
using: 'composite'
steps:
- name: Add hosts entry
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo "127.0.0.1 mariadb.example.com" >> /c/Windows/System32/drivers/etc/hosts
else
echo "127.0.0.1 mariadb.example.com" | sudo tee -a /etc/hosts
fi
- name: Generate self-signed certificates
shell: bash
run: |
SCRIPT_PATH="${{ github.action_path }}/generate-certs.sh"
if [ "$RUNNER_OS" == "Windows" ]; then
SCRIPT_PATH=$(echo "$SCRIPT_PATH" | sed 's|\\|/|g' | sed 's|C:|/c|')
fi
chmod +x "$SCRIPT_PATH"
"$SCRIPT_PATH"
- name: Setup MariaDB
id: mariadb-install
if: inputs.db-type != 'mysql'
uses: rusher/action-setup-mariadb@master
with:
tag: ${{ inputs.db-tag }}
root-password: ${{ inputs.test-db-password }}
database: ${{ inputs.test-db-database }}
registry: ${{ inputs.db-type == 'enterprise' && 'docker.mariadb.com/enterprise-server' || (inputs.db-type == 'dev' && 'quay.io/mariadb-foundation/mariadb-devel' || '') }}
registry-user: ${{ inputs.registry-user }}
registry-password: ${{ inputs.registry-password }}
additional-conf: |
${{ inputs.additional-conf }}
${{ '--loose-caching_sha2_password_auto_generate_rsa_keys=1'}}
${{ startsWith(inputs.os, 'windows') && format('--ssl-ca={0}/.github/workflows/certs/ca.crt', github.workspace) || '--ssl-ca=/etc/mysql/conf.d/ca.crt'}}
${{ startsWith(inputs.os, 'windows') && format('--ssl-cert={0}/.github/workflows/certs/server.crt', github.workspace) || '--ssl-cert=/etc/mysql/conf.d/server.crt'}}
${{ startsWith(inputs.os, 'windows') && format('--ssl-key={0}/.github/workflows/certs/server.key', github.workspace) || '--ssl-key=/etc/mysql/conf.d/server.key'}}
${{ '--max-connections=500'}}
conf-script-folder: ${{ github.workspace }}/.github/workflows/certs
init-script-folder: ${{ inputs.init-script-folder }}
port: ${{ inputs.test-db-port }}
- name: Setup MySQL
if: inputs.db-type == 'mysql'
shell: bash
run: |
SCRIPT_PATH="${{ github.action_path }}/setup-mysql.sh"
if [ "$RUNNER_OS" == "Windows" ]; then
SCRIPT_PATH=$(echo "$SCRIPT_PATH" | sed 's|\\|/|g' | sed 's|C:|/c|')
fi
chmod +x "$SCRIPT_PATH"
"$SCRIPT_PATH" \
"${{ inputs.db-tag }}" \
"${{ inputs.test-db-database }}" \
"${{ inputs.test-db-password }}" \
"${{ inputs.test-db-port }}" \
"${{ inputs.registry-user }}" \
"${{ inputs.registry-password }}" \
"${{ inputs.db-type == 'mysql' && 'docker.io' || '' }}" \
"${{ inputs.os }}" \
"${{ github.workspace }}"