forked from phillbaker/terraform-provider-elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 5
82 lines (79 loc) · 2.54 KB
/
workflow.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
name: "build"
on:
push:
branches:
- main
- 7.x
- 8.x
tags:
- "*"
pull_request:
branches:
- main
- 7.x
- 8.x
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.18"
- name: Setup Elasticsearch
run: |
set -e
docker-compose up &
until $(curl --output /dev/null --silent --head --fail -u elastic:changeme http://localhost:9200); do sleep 5; done
curl -XPOST -u elastic:changeme http://localhost:9200/_license/start_trial?acknowledge=true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 600s
- name: Run build
run: make build
- name: Run acceptance tests
run: |
mv es/resource_elasticsearch_license_test.go es/resource_elasticsearch_license_test.go.disable
ELASTICSEARCH_URLS="http://localhost:9200" ELASTICSEARCH_USERNAME="elastic" ELASTICSEARCH_PASSWORD="changeme" make testacc
- name: Run acceptance test on license resource
run: |
set -e
cat cover.out > coverage.out
mv es/resource_elasticsearch_license_test.go.disable es/resource_elasticsearch_license_test.go
TESTARGS="-run TestAccElasticsearchLicense" ELASTICSEARCH_URLS="http://localhost:9200" ELASTICSEARCH_USERNAME="elastic" ELASTICSEARCH_PASSWORD="changeme" make testacc
cat cover.out >> coverage.out
- uses: codecov/codecov-action@v2
with:
files: coverage.out
flags: unittests
fail_ci_if_error: true
goreleaser:
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Import GPG key
id: import_gpg
uses: paultyng/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}