-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (97 loc) · 3.15 KB
/
Copy pathtest_builder.yml
File metadata and controls
113 lines (97 loc) · 3.15 KB
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
name: Test and Build
on:
push:
branches: [ main ]
tags:
- 'v*' # Run on version tags like v1.0.0
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Run blocker tests
working-directory: go_security_app
run: go test -short
build:
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [amd64, arm64]
exclude:
- os: windows-latest
arch: arm64
- os: macos-latest
arch: amd64
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Determine GOOS
id: goos
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
echo "value=linux" >> $GITHUB_OUTPUT
elif [ "${{ matrix.os }}" == "windows-latest" ]; then
echo "value=windows" >> $GITHUB_OUTPUT
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
echo "value=darwin" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Determine file extension
id: ext
run: |
if [ "${{ matrix.os }}" == "windows-latest" ]; then
echo "value=.exe" >> $GITHUB_OUTPUT
else
echo "value=" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Build
working-directory: go_security_app
run: GOOS=${{ steps.goos.outputs.value }} GOARCH=${{ matrix.arch }} go build -o request_security_checker-${{ steps.goos.outputs.value }}-${{ matrix.arch }}${{ steps.ext.outputs.value }}
shell: bash
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: request_security_checker-${{ steps.goos.outputs.value }}-${{ matrix.arch }}
path: go_security_app/request_security_checker-${{ steps.goos.outputs.value }}-${{ matrix.arch }}${{ steps.ext.outputs.value }}
retention-days: 7
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List downloaded artifacts
run: ls -R artifacts
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
body_path: CHANGELOG.md
draft: false
prerelease: false
files: |
artifacts/request_security_checker-linux-amd64/request_security_checker-linux-amd64
artifacts/request_security_checker-linux-arm64/request_security_checker-linux-arm64
artifacts/request_security_checker-windows-amd64/request_security_checker-windows-amd64.exe
artifacts/request_security_checker-darwin-arm64/request_security_checker-darwin-arm64