-
-
Notifications
You must be signed in to change notification settings - Fork 30
59 lines (52 loc) · 1.92 KB
/
tests.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
---
name: Tests
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Pull docker images
run: |
docker pull ruby:3.0.1-alpine --quiet
docker-compose -f docker-compose.ci.yml pull --quiet
# Cache the docker layers to help speed up the Docker build times.
- uses: satackey/action-docker-layer-caching@v0
with:
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-
# We as store the node_modules & gems outside of the build, we can use actions/cache to persist them between
# runs of this action.
- name: Cache Assets
uses: actions/cache@v2
with:
path: |
**/node_modules
public/assets
public/packs-test
key: ${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}
- name: Cache gems
uses: actions/cache@v2
with:
path: |
vendor/bundle
key: ${{ runner.os }}-bundle-${{ hashFiles('**/Gemfile.lock') }}
# Build the Docker image we're testing our app on.
- name: Build Latest
run: |
docker-compose -f docker-compose.ci.yml build --build-arg USER_ID="$(id -u)" --build-arg GROUP_ID="$(id -u)" test
# Download the node_modules & gems, along with setting up a clean database.
- name: Setup Environment
run: |
docker-compose -f docker-compose.ci.yml run --rm --user="$(id -u):$(id -g)" test ./bin/setup
# Finally run the tests :D
- name: Run tests
run: |
docker-compose -f docker-compose.ci.yml run --rm --user="$(id -u):$(id -g)" test
# This will remove any dangling docker data & stop our cache from ballooning out of control.
- name: Clean Up After Tests
run: |
docker image prune -f
docker volume prune -f