-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (44 loc) · 1.52 KB
/
build_test.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
name: Build-Test
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Github Action cache
uses: actions/cache@v3
with:
path: |
~/caches
key: ${{ runner.os }}-${{ hashFiles('Gemfile.lock') }}
- name: Load Docker image
run: |
set +o pipefail
docker load -i ~/caches/cerberus.tar | true
- name: Build the Docker image
run: docker build --cache-from=nakatomi/cerberus_web:latest . --file Dockerfile --tag nakatomi/cerberus_web:latest --tag nakatomi/cerberus_web:$(cat .version)
- name: Save Docker image
run: |
mkdir -p ~/caches
docker save -o ~/caches/cerberus.tar nakatomi/cerberus_web
- name: Setup dockerize
uses: zcong1993/[email protected]
- name: Start server
run: |
set -x
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d
- name: Create database and migrate
run: |
docker-compose exec -T web bundle exec rake db:create
docker-compose exec -T web bundle exec rake db:migrate
- name: Wait until available
run: dockerize -wait http://localhost:3000 -timeout 1m
- name: Run tests
run: |
docker-compose exec -T web cc-test-reporter before-build
docker-compose exec -T web bundle exec rake
docker-compose exec -T web cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?