-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (47 loc) · 1.28 KB
/
test-and-lint.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
name: Run tests and lint
on:
# Enable manually triggering this workflow
workflow_dispatch:
# Run whenever a pull request is opened on any branch
pull_request:
branches:
- "*"
# Run whenever we push to main
push:
branches:
- "main"
jobs:
# Job name
test-and-lint:
# Run on Windows and Linux
strategy:
matrix:
os: [ubuntu-latest]
# Set which runner to use
runs-on: ${{ matrix.os }}
# Define environment
env:
EXE_NAME: adder.exe
IMAGE_TAG: adder-image:latest
# Define steps for the job
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
- name: Run Go unit tests
run: go test ./...
- name: Lint Go code
uses: golangci/golangci-lint-action@v6
- name: Check we can build the Go executable
run: go build -o ${EXE_NAME} cmd/main.go
- name: Check we can run the Go executable
run: ./${EXE_NAME} 1 2
- name: Check we can build the Docker image
uses: docker/build-push-action@v3
with:
push: false
tags: ${{ env.IMAGE_TAG }}
build-args: "GO_VERSION=${{ vars.GO_VERSION }}"
- name: Check we can run the Docker image
run: docker run ${IMAGE_TAG} 3 4