-
Notifications
You must be signed in to change notification settings - Fork 83
146 lines (114 loc) · 3.9 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Copyright 2023 Terramate GmbH
# SPDX-License-Identifier: MPL-2.0
name: ci
on:
push:
branches:
- main
- v0.4.x
pull_request:
jobs:
checks:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Configure asdf and plugins needed
uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267
- name: checking go mod tidyness
run: terramate run --tags golang --changed -- make mod/check
- name: linting code
run: terramate run --tags golang --changed -- make lint
- name: checking license on source code
run: terramate run --tags golang --changed -- make license/check
build_test:
name: Build and Test
runs-on: ${{ matrix.os }}
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
strategy:
matrix:
os: ["ubuntu-20.04", "macos-13"]
go: ["1.21"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.6.2
tofu_wrapper: false
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure asdf and plugins needed
uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267
- name: make generate
run: terramate generate
- name: make test
run: terramate run --tags golang --changed -- make test
env:
TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5"
- name: make build
run: terramate run --tags golang --changed -- make build
- name: check cloud info
run: terramate run --tags golang --changed -- ./bin/terramate -vv experimental cloud info
gh_integration_test:
name: GHA Integration Test
runs-on: "ubuntu-20.04"
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Configure asdf and plugins needed
uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267
- name: make test/ci
run: terramate run --tags golang --changed -- make test/ci
release_dry_run:
name: Release Dry Run
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Configure asdf and plugins needed
uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267
- name: install cosign
run: go install github.com/sigstore/cosign/v2/cmd/cosign@latest
- name: install goreleaser
run: |
curl -sL https://github.com/goreleaser/goreleaser-pro/releases/download/v1.14.0-pro/goreleaser-pro_Linux_x86_64.tar.gz -o goreleaser.tar.gz
tar -xzf goreleaser.tar.gz
chmod +x goreleaser
sudo mv goreleaser /usr/local/bin/
- name: release dry run
run: terramate run --tags golang --changed -- make release/dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_API_KEY }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN}}
ci:
needs:
- checks
- build_test
- gh_integration_test
runs-on: ubuntu-20.04
steps:
- uses: Kesin11/actions-timeline@v1