-
Notifications
You must be signed in to change notification settings - Fork 4
156 lines (154 loc) · 4.58 KB
/
main.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
147
148
149
150
151
152
153
154
155
156
---
name: main
on:
push:
branches:
- '**'
jobs:
go-test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Test
run: make test
go-lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.49
args: --timeout 30m
go-build:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Build
uses: goreleaser/goreleaser-action@v3
with:
args: release --skip-publish --skip-sign --snapshot --timeout=60m
- name: Read metadata
id: metadata
uses: juliangruber/read-file-action@v1
with:
path: target/dist/metadata.json
- name: Prepare artifacts
run: |
mkdir -p tmp/bin
cp target/dist/benthos_linux_amd64_v1/benthos tmp/bin/benthos
cp "target/dist/benthos-lambda-al2_${VERSION}_linux_amd64.zip" tmp/benthos-lambda-al2_linux_amd64.zip
cp "target/dist/benthos-lambda-al2_${VERSION}_linux_arm64.zip" tmp/benthos-lambda-al2_linux_arm64.zip
env:
VERSION: ${{ fromJSON(steps.metadata.outputs.content).version }}
- name: Upload Benthos artifacts
uses: actions/upload-artifact@v3
with:
name: benthos
path: tmp/bin/benthos
retention-days: 2
- name: Upload Benthos Lambda amd64 artifact
uses: actions/upload-artifact@v3
with:
name: benthos-lambda_linux_amd64.zip
path: tmp/benthos-lambda-al2_linux_amd64.zip
retention-days: 2
- name: Upload Benthos Lambda arm64 artifact
uses: actions/upload-artifact@v3
with:
name: benthos-lambda_linux_arm64.zip
path: tmp/benthos-lambda-al2_linux_arm64.zip
retention-days: 2
test:
needs: go-build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Download Benthos artifact
uses: actions/download-artifact@v3
with:
name: benthos
path: tmp/bin
- name: Install Benthos to PATH
run: |
chmod 755 tmp/bin/benthos
echo "$(pwd)/tmp/bin" >> $GITHUB_PATH
- name: Test
run: npm test
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Lint
run: npm run lint
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Docker
uses: ./.github/actions/setup-docker
with:
registry_domain: ghcr.io
registry_username: ${{ secrets.GH_USER }}
registry_password: ${{ secrets.GH_TOKEN }}
- name: Build
uses: docker/build-push-action@v3
with:
push: true
platforms: linux/amd64,linux/arm64
cache-from: 'type=local,src=/tmp/.buildx-cache'
cache-to: 'type=local,dest=/tmp/.buildx-cache'
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
- name: Remove CI container image
uses: bots-house/ghcr-delete-image-action@v1.0.1
if: always()
with:
owner: ${{ github.repository_owner }}
name: ${{ github.event.repository.name }}
tag: ${{ github.sha }}
token: ${{ secrets.GH_TOKEN }}
package:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: go-build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Download Benthos Lambda amd64 artifact
uses: actions/download-artifact@v3
with:
name: benthos-lambda_linux_amd64.zip
path: tmp
- name: Download Benthos Lambda arm64 artifact
uses: actions/download-artifact@v3
with:
name: benthos-lambda_linux_arm64.zip
path: tmp
- name: Build
run: npm run build
- name: Serverless package
run: npm run sls:package