-
Notifications
You must be signed in to change notification settings - Fork 18
132 lines (125 loc) · 3.8 KB
/
pipeline.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
name: Pipeline
on:
push:
branches: [ master ]
pull_request:
paths-ignore:
- '**.md'
env:
CI: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with: { go-version: '1.15' }
- name: Run linters
run: make lint
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with: { go-version: '1.15' }
- name: Build daemon
run: make daemon TAG=test
- name: Cache daemon image
uses: actions/upload-artifact@v1
with:
name: inertia-daemon-image
path: images/inertia-daemon-image
# On Ubuntu, we run all our tests, except for the bootstrap tests
test-core:
runs-on: ubuntu-latest
needs: [ build, lint ]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with: { go-version: '1.15' }
- name: Install Docker dependencies
run: bash test/docker_deps.sh
- name: Start test container
run: docker run --name testcontainer -d nginx
- name: Execute tests
run: go test -race -tags no_bootstrap -coverprofile=coverage.txt ./...
- uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: test-core
fail_ci_if_error: true
# On Windows, we run a subset of unit tests (primarily for the CLI)
test-windows:
runs-on: windows-latest
needs: [ build, lint ]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with: { go-version: '1.15' }
- name: Execute tests
run: |
go test -short -coverprofile="coverage.txt" ./cfg ./client ./cmd ./common ./local ./provision
- uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: test-windows
fail_ci_if_error: true
# Test Inertia daemon initialization in a variety of scenarios
test-bootstrap:
runs-on: ubuntu-latest
needs: [ test-core ]
strategy:
matrix:
case: [ debian-9.3, centos-7, amazon-1, ubuntu-16.04, ubuntu-18.04, pull-image ]
include:
# These test cases verify that the inertia daemon built from this commit can
# start correctly on various emulated platforms.
- case: debian-9.3
os_name: debian
os_version: 9.3
- case: centos-7
os_name: centos
os_version: 7
- case: amazon-1
os_name: amazon
os_version: 1
- case: ubuntu-16.04
os_name: ubuntu
os_version: 16.04
- case: ubuntu-18.04
os_name: ubuntu
os_version: 18.04
# This test case verifies that we pull and run published images correctly.
- case: pull-image
os_name: ubuntu
os_version: 18.04
pull_image: true
fail-fast: false
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with: { go-version: '1.15' }
- name: Start mock VPS (${{ matrix.os_name }} ${{ matrix.os_version }})
run: |
make testenv \
VPS_OS=${{ matrix.os_name }} \
VPS_VERSION=${{ matrix.os_version }} \
SSH_PORT=69
- name: Pull daemon image
if: ${{ ! matrix.pull_image }}
uses: actions/download-artifact@v1
with:
name: inertia-daemon-image
path: images/
- name: Set up daemon image
if: ${{ ! matrix.pull_image }}
run: make testdaemon-scp
- name: Run bootstrap test
run: go test ./... -v -run 'TestBootstrap_Integration' -coverprofile=coverage.txt -ldflags "-X github.com/ubclaunchpad/inertia/cmd.Version=test"
env:
INTEGRATION_PULL_IMAGE: ${{ matrix.pull_image }}
- uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: test-bootstrap-${{ matrix.case }}
fail_ci_if_error: true