-
Notifications
You must be signed in to change notification settings - Fork 456
87 lines (81 loc) · 2.41 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
name: 'Test'
on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
workflow_dispatch:
jobs:
# Only checking latest Linux/UNIX on pulls to save execution times
test-master-pulls:
if: github.event_name == 'pull_request'
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os:
- 'macos-latest'
- 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 1
- name: 'Install Dependencies'
run: './test/install_deps.sh'
- name: 'Run all tests'
run: './test/run.sh'
shell: 'bash'
- uses: 'docker/setup-buildx-action@v3'
if: contains(matrix.os, 'ubuntu')
with:
install: true
- uses: 'docker/build-push-action@v5'
if: contains(matrix.os, 'ubuntu')
with:
context: .
load: true
tags: "tfenv-terraform:${{ github.sha }}"
- name: 'Check Dockerfile'
if: contains(matrix.os, 'ubuntu')
run: |
expect=1.2.3;
got="$(docker run -e "TFENV_TERRAFORM_VERSION=${expect}" "tfenv-terraform:${{ github.sha }}" version)";
echo "${got}" | tee /dev/stderr | grep -e 'Terraform v1.2.3'
# When we push to master, test everything in order to guarantee releases
test-master-pushes:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os:
- 'macos-11'
- 'macos-10.15'
- 'ubuntu-20.04'
- 'ubuntu-18.04'
- 'windows-2019'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 1
- name: 'Install Dependencies'
run: './test/install_deps.sh'
- name: 'Run all tests'
run: './test/run.sh'
shell: 'bash'
- uses: 'docker/setup-buildx-action@v3'
if: contains(matrix.os, 'ubuntu')
with:
install: true
- uses: 'docker/build-push-action@v5'
if: contains(matrix.os, 'ubuntu')
with:
context: .
load: true
tags: 'tfenv-terraform:latest'
- name: 'Check Dockerfile'
if: contains(matrix.os, 'ubuntu')
run: |
expect=1.2.3;
got="$(docker run -e "TFENV_TERRAFORM_VERSION=${expect}" tfenv-terraform:latest version)";
echo "${got}" | tee /dev/stderr | grep -e 'Terraform v1.2.3'