forked from ForgeRock/secret-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2.13 KB
/
ci.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
82
name: CI
on:
push:
branches: [ master]
pull_request:
branches: [ master]
jobs:
basic-checks:
name: Run basic-checks
runs-on: ubuntu-latest
# container: golang:1.14-buster
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: go-fmt
run: go fmt ./...
- name: Check for uncommited formatting
run: if [ -n "$(git status --untracked-files=no --porcelain)" ]; then echo "There are uncommitted changes"; exit 1; fi
integration-tests:
name: Run integration-tests
needs: basic-checks
runs-on: ubuntu-latest
env:
GOFLAGS: -buildvcs=false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build Test Image
run: docker build -t secret-agent-tester --target=tester .
- name: Test
run: docker run -i -e GOFLAGS --rm -v ${GITHUB_WORKSPACE}:/root/go/src/github.com/ForgeRock/secret-agent secret-agent-tester make citest
build:
name: Build Pull Request Binaries
needs: integration-tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- name: Set Go Releaser Environment
run: |
echo "GIT_DIRTY="$(test -n "`git status --porcelain`" && echo "+CHANGES" || true) >> $GITHUB_ENV
echo "BUILD_DATE="$(date '+%Y-%m-%d-%H:%M:%S') >> $GITHUB_ENV
- name: Build Snapshot
if: ${{ github.event_name == 'pull_request' }}
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ env.BUILD_DATE }}-pr.${{ github.event.pull_request.number }}
GIT_COMMIT: ${{ github.sha }}
IMAGE_NAME: "forgerock/secret-agent"
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: dist/*.tar.gz