-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (66 loc) · 2.18 KB
/
db-schma.yml
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
name: db-schema CI
on:
push:
branches: [master, test, dev]
pull_request:
branches: [master, test, dev]
schedule:
- cron: "42 15 * * 5"
jobs:
build:
name: db-schema
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
env:
working-directory: ./source/database/mssql/scripts/dbscripts
steps:
- uses: actions/checkout@v4
- name: Set up random env variable
run: |
passvar=$(date +%s | sha256sum | base64 | head -c 29)A8!
last_sprint=$(ls -d */ | tail -n 1 | cut -f1 -d'/')
echo \
"ACCEPT_EULA=Y
MSSQL_SA_PASSWORD=$passvar
MSSQL_PID=Developer
TZ=America/Los_Angeles
TARGET_SPRINT=$last_sprint
DB_USER=admin
DB_PASSWORD=$passvar
TIMEOUT_LENGTH=120" >> ./.env
chmod +x ./entrypoint.sh
chmod +x ./setup.sh
working-directory: ${{env.working-directory}}
- name: Build ms sql 2019 stack
run: |
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
working-directory: ${{env.working-directory}}
- name: Build db-schema and load schema
run: docker run -d -p 5433:1433 --name db-schema --env-file ./.env docker.io/my-organization/my-app:${{ github.sha }}
working-directory: ${{env.working-directory}}
- name: Wait on the sqlserver process
uses: jakejarvis/wait-action@master
with:
time: "120s"
- name: Check running containers
run: docker ps -a
- name: Check pims-database logs
run: docker logs db-schema
- name: Check schema build
run: |
docker cp db-schema:/tmp/log.txt .
result="$(cat log.txt)"
echo "Error code ${result}"
if [[ "$result" == "0" ]]; then
echo "=======DB SCHEMA LOADED ========";
else
echo "There's an error loading schema" && exit 1 ;
fi
working-directory: ${{env.working-directory}}
- name: Stop containers
if: always()
run: docker stop db-schema
working-directory: ${{env.working-directory}}