forked from nutcr4cker/terraform-kea-dhcp4
-
Notifications
You must be signed in to change notification settings - Fork 4
76 lines (65 loc) · 2.01 KB
/
ci.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
name: CI
on:
push:
branches: [ master ]
tags:
- v*
paths:
- '**.go'
pull_request:
branches: [ master ]
workflow_dispatch: {}
jobs:
build:
name: "Build, test and release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Create Terraform plugins directory
run: mkdir -p ~/.terraform.d/plugins/terraform.local/feliksas/kea-dhcp4/1.0.0/linux_amd64/
- name: Build
env:
CGO_ENABLED: "0"
GOOS: linux
GOARCH: amd64
run: go build -v -a -o ~/.terraform.d/plugins/terraform.local/feliksas/kea-dhcp4/1.0.0/linux_amd64/terraform-provider-kea-dhcp4_v1.0.0
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.4
- name: Set up test environment
run: |
docker network create kea
docker build -t kea-test -f kea.Dockerfile .
docker build -t nginx-test -f api.Dockerfile .
docker run -d --network kea --name kea kea-test
docker run -d --network kea --name api -p 127.0.0.1:8080:8080/tcp nginx-test
- name: Test
working-directory: test-data/terraform
run: |
terraform init
terraform apply -auto-approve
terraform destroy -auto-approve
- name: Import GPG key
if: startsWith(github.ref, 'refs/tags/')
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}