-
Notifications
You must be signed in to change notification settings - Fork 349
148 lines (145 loc) · 5.41 KB
/
push.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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Unit Tests
on:
push:
paths-ignore:
- "*.md"
- "docs/**"
pull_request:
paths-ignore:
- "*.md"
- "docs/**"
env:
RAILS_ENV: "test"
DF_STUDENT_WORK_DIR: "/student-work"
DF_INSTITUTION_HOST: "http://localhost:3000"
DF_INSTITUTION_PRODUCT_NAME: "OnTrack"
DF_SECRET_KEY_BASE: "test-secret-key-test-secret-key!"
DF_SECRET_KEY_ATTR: "test-secret-key-test-secret-key!"
DF_SECRET_KEY_DEVISE: "test-secret-key-test-secret-key!"
DF_TEST_DB_ADAPTER: "mysql2"
DF_TEST_DB_HOST: "mariadb"
DF_TEST_DB_DATABASE: "doubtfire-test"
DF_TEST_DB_USERNAME: "dfire"
DF_TEST_DB_PASSWORD: "pwd"
OVERSEER_ENABLED: "0"
DF_ENCRYPTION_PRIMARY_KEY: "AMLOMYA5GV8B4fTK3VKMhVGn8WdvUW8g"
DF_ENCRYPTION_DETERMINISTIC_KEY: "anlmuJ6cB3bN3biXRbYvmPsC5ALPFqGG"
DF_ENCRYPTION_KEY_DERIVATION_SALT: "hzPR8D4qpOnAg7VeAhkhWw6JmmzKJB10"
DF_REDIS_SIDEKIQ_URL: "redis://redis:6379/0"
LATEX_CONTAINER_NAME: doubtfire-texlive
LATEX_BUILD_PATH: /texlive/shell/latex_build.sh
jobs:
unit-tests:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb
env:
MARIADB_USER: ${{ env.DF_TEST_DB_USERNAME }}
MARIADB_PASSWORD: ${{ env.DF_TEST_DB_PASSWORD }}
MARIADB_DATABASE: ${{ env.DF_TEST_DB_DATABASE }}
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes # This is required or the healthcheck script can't connect to the db
options: --health-cmd "/usr/local/bin/healthcheck.sh --connect --innodb_initialized" --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:7.0
options: --health-cmd "redis-cli ping | grep PONG" --health-interval 1s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Build TexLive image
uses: docker/build-push-action@v5
with:
context: .
file: texlive.Dockerfile
push: false
load: true
tags: doubtfire-texlive-development:local
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build base doubtfire-api development image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: doubtfire-api-development:local
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Start TexLive service
uses: addnab/docker-run-action@v3
with:
image: doubtfire-texlive-development:local
options: >
--name ${{ env.LATEX_CONTAINER_NAME }}
-v ${{ github.workspace }}/student-work:/student-work
-v ${{ github.workspace }}/public/assets/images:/doubtfire/public/assets/images
-v ${{ github.workspace }}/test_files:/doubtfire/test_files
-v ${{ github.workspace }}/tmp/rails-latex:/workdir/texlive-latex
--detach
run: /bin/sh -c "while sleep 5000; do :; done"
- name: Test TexLive container
uses: addnab/docker-run-action@v3
with:
image: doubtfire-api-development:local
options: >
-v ${{ github.workspace }}:/doubtfire
-v /var/run/docker.sock:/var/run/docker.sock
run: docker exec -t ${{ env.LATEX_CONTAINER_NAME }} lualatex -v
- name: Populate database
uses: addnab/docker-run-action@v3
with:
image: doubtfire-api-development:local
options: >
-v ${{ github.workspace }}:/doubtfire
-v ${{ github.workspace }}/student-work:/student-work
-v /var/run/docker.sock:/var/run/docker.sock
-e RAILS_ENV
-e DF_STUDENT_WORK_DIR
-e DF_INSTITUTION_HOST
-e DF_INSTITUTION_PRODUCT_NAME
-e DF_SECRET_KEY_BASE
-e DF_SECRET_KEY_ATTR
-e DF_SECRET_KEY_DEVISE
-e DF_TEST_DB_ADAPTER
-e DF_TEST_DB_HOST
-e DF_TEST_DB_DATABASE
-e DF_TEST_DB_USERNAME
-e DF_TEST_DB_PASSWORD
-e OVERSEER_ENABLED
-e DF_ENCRYPTION_PRIMARY_KEY
-e DF_ENCRYPTION_DETERMINISTIC_KEY
-e DF_ENCRYPTION_KEY_DERIVATION_SALT
-e DF_REDIS_SIDEKIQ_URL
-e LATEX_CONTAINER_NAME
-e LATEX_BUILD_PATH
run: bundle exec rake db:populate
- name: Run unit tests
uses: addnab/docker-run-action@v3
with:
image: doubtfire-api-development:local
options: >
-v ${{ github.workspace }}:/doubtfire
-v ${{ github.workspace }}/student-work:/student-work
-v /var/run/docker.sock:/var/run/docker.sock
-e RAILS_ENV
-e DF_STUDENT_WORK_DIR
-e DF_INSTITUTION_HOST
-e DF_INSTITUTION_PRODUCT_NAME
-e DF_SECRET_KEY_BASE
-e DF_SECRET_KEY_ATTR
-e DF_SECRET_KEY_DEVISE
-e DF_TEST_DB_ADAPTER
-e DF_TEST_DB_HOST
-e DF_TEST_DB_DATABASE
-e DF_TEST_DB_USERNAME
-e DF_TEST_DB_PASSWORD
-e OVERSEER_ENABLED
-e DF_ENCRYPTION_PRIMARY_KEY
-e DF_ENCRYPTION_DETERMINISTIC_KEY
-e DF_ENCRYPTION_KEY_DERIVATION_SALT
-e DF_REDIS_SIDEKIQ_URL
-e LATEX_CONTAINER_NAME
-e LATEX_BUILD_PATH
run: TERM=xterm bundle exec rails test