Skip to content

Commit 3cf95af

Browse files
authored
Merge pull request #198 from snabble/fix-gh-actions
Fix gh actions and add workflow
2 parents 88923b3 + 3d95547 commit 3cf95af

File tree

2 files changed

+46
-21
lines changed

2 files changed

+46
-21
lines changed

.github/actions/build/action.yml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
name: Build and Test
2-
description: "Build and test it"
3-
4-
inputs:
5-
docker_password:
6-
description: "Password to log into Dockerhub"
7-
required: true
8-
go_build_token:
9-
description: "Token that allows to push to the Google Artifact Registry"
10-
required: true
11-
1+
name: build and test
122
runs:
13-
using: "composite"
3+
using: composite
144
steps:
15-
- name: Clone build-helper
16-
uses: actions/checkout@v4
5+
- name: Setup go
6+
uses: actions/setup-go@v6
177
with:
18-
repository: snabble/build-helper
19-
path: build-helper
20-
token: "${{ inputs.go_build_token }}"
8+
go-version-file: ./go.mod
219

22-
- name: build
23-
uses: ./build-helper/.github/workflows/build-go-library
24-
with:
25-
gh-token: ${{inputs.go_build_token}}
10+
- name: Run go vet
11+
shell: bash
12+
run: go vet ./...
13+
14+
- name: Run Staticcheck
15+
shell: bash
16+
run: |
17+
go install honnef.co/go/tools/cmd/staticcheck@latest && \
18+
staticcheck ./...
19+
20+
- name: Test the source
21+
shell: bash
22+
run: go test ./...

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build and conditionally deploy
2+
on:
3+
# enable button to trigger the run manually
4+
workflow_dispatch:
5+
6+
# trigger on all pull request movement:
7+
pull_request:
8+
9+
# trigger on pushes to default branch
10+
push:
11+
branches:
12+
- master
13+
14+
# cancel previous build for new commit pushes in the same pr
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: build and test
28+
uses: ./.github/actions/build

0 commit comments

Comments
 (0)