generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (70 loc) · 2.53 KB
/
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
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
name: Test
on: push
env:
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }}
DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }}
DOCKER_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_IMAGE: ${{ github.repository }}
# Set the default docker-compose file
COMPOSE_FILE: docker-compose.test.yml
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/[email protected]
- name: Set env BRANCH_TAG
uses: nimblehq/[email protected]
- name: Login to Docker registry
uses: docker/[email protected]
with:
registry: ${{ env.DOCKER_REGISTRY_HOST }}
username: ${{ env.DOCKER_REGISTRY_USERNAME }}
password: ${{ env.DOCKER_REGISTRY_TOKEN }}
- name: Pull Docker image
if: ${{ env.BRANCH_TAG != 'latest' && env.BRANCH_TAG != 'development' }}
run: docker-compose pull test || true
- name: Build Docker image
run: bin/docker-prepare && docker-compose build
- name: Push Docker image
run: docker-compose push test
unit_tests:
name: Unit tests
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/[email protected]
- name: Set env BRANCH_TAG
uses: nimblehq/[email protected]
- name: Login to Docker registry
uses: docker/[email protected]
with:
registry: ${{ env.DOCKER_REGISTRY_HOST }}
username: ${{ env.DOCKER_REGISTRY_USERNAME }}
password: ${{ env.DOCKER_REGISTRY_TOKEN }}
- name: Pull Docker image
run: docker-compose pull test || true
- name: Run unit tests
run: docker-compose run test bundle exec rspec --exclude-pattern "spec/systems/**/*_spec.rb" --profile
system_tests:
name: System tests
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/[email protected]
- name: Set env BRANCH_TAG
uses: nimblehq/[email protected]
- name: Login to Docker registry
uses: docker/[email protected]
with:
registry: ${{ env.DOCKER_REGISTRY_HOST }}
username: ${{ env.DOCKER_REGISTRY_USERNAME }}
password: ${{ env.DOCKER_REGISTRY_TOKEN }}
- name: Pull Docker image
run: docker-compose pull test || true
- name: Run system tests
run: docker-compose run test bundle exec rspec spec/systems --profile