-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (65 loc) · 2.1 KB
/
run_test.yaml
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
name: Run tests and example config
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
run_test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install plugin framework and example plugins
run: |
pip install ./python-plugins ./example/plugin-example
- name: Run all pre-commit hooks
run: |
pip install pre-commit
# Install tfsec
curl -s https://raw.githubusercontent.com/aquasecurity/tfsec/master/scripts/install_linux.sh | bash
# Install tflint
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
pre-commit run --all
if: matrix.os == 'ubuntu-latest'
- uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
- name: Install Go toolchain
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
cache-dependency-path: "go.sum"
- name: Code Consistency Checks
if: matrix.os == 'ubuntu-latest'
run: |
output=$(gofmt -l .)
echo "$output"
test -z $output
- name: Generate Binary Name
id: binary_name
shell: bash
run: |
binary_name="infra-tester"
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
binary_name="${binary_name}.exe"
fi
echo "binary_name=$binary_name" >> "$GITHUB_OUTPUT"
- name: Compile Test Binary
run: |
go build -o bin/${{ steps.binary_name.outputs.binary_name }}
- name: Run Example Terraform Tests
run: |
cd example
../bin/${{ steps.binary_name.outputs.binary_name }} "-test.v"