Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions .github/workflows/go-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,41 @@ on:
branches: [ "main" ]
workflow_dispatch: {}

permissions: {}

jobs:
test:
go-versions:
runs-on: ubuntu-latest
outputs:
stable: ${{ steps.versions.outputs.GO_MINOR_VERSION_STABLE }}
previous: ${{ steps.versions.outputs.GO_MINOR_VERSION_PREVIOUS }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Determine Go versions
id: versions
uses: carabiner-dev/actions/go/versions@360ffa1eb909b0105d4eccb6d6ef337911c34952 # main

test:
needs: go-versions
name: Go Tests (go ${{ matrix.go-version }}, ${{ matrix.os }})
permissions:
contents: read

runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version:
- ${{ needs.go-versions.outputs.previous }}
- ${{ needs.go-versions.outputs.stable }}
os:
- ubuntu-latest
- macos-latest
- windows-latest
fail-fast: false

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand All @@ -19,11 +51,10 @@ jobs:
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
go-version: ${{ matrix.go-version }}
check-latest: true
cache: true

- name: Test
run: |
go get -d ./...
go test -v ./...
go test -v ./... --cover
23 changes: 19 additions & 4 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,27 @@ on:
branches:
- main

permissions:
contents: read
permissions: {}

jobs:
go-versions:
runs-on: ubuntu-latest
outputs:
stable: ${{ steps.versions.outputs.GO_VERSION_STABLE }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Determine Go versions
id: versions
uses: carabiner-dev/actions/go/versions@360ffa1eb909b0105d4eccb6d6ef337911c34952 # main

golangci:
name: lint
needs: go-versions
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -23,10 +38,10 @@ jobs:

- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
go-version: ${{ needs.go-versions.outputs.stable }}
cache: true

- name: Run golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v2.10
version: v2.11
40 changes: 19 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,43 @@ on:
tags:
- 'v*'

permissions: {}

jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write # needed to write releases
contents: write # needed to write releases

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false

- name: Set tag output
id: tag
run: echo "tag_name=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"

- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v3
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: false
cache: false
check-latest: true

- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1

- name: Install bom
uses: kubernetes-sigs/release-actions/setup-bom@8753ea6bdadb814d779c6ec34eaca689dbfb492b # v0.4.3

- name: Generate SBOM
shell: bash
run: |
bom generate --format=json -o /tmp/${{github.event.repository.owner}}-${{github.event.repository.name}}-${{ steps.tag.outputs.tag_name }}.spdx.json .
- name: Set tag output
id: tag
run: echo "tag_name=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"

- name: Publish Release
uses: kubernetes-sigs/release-actions/publish-release@8753ea6bdadb814d779c6ec34eaca689dbfb492b # v0.4.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
assets: "/tmp/${{github.event.repository.owner}}-${{github.event.repository.name}}-${{ steps.tag.outputs.tag_name }}.spdx.json"
sbom: false

- name: Generate SBOM
id: sbom
uses: carabiner-dev/actions/unpack/sbom@73e94b6ec4adbf65bb7b9f4ecec334dc6576553f # v1.1.6
with:
push-to-release: ${{ steps.tag.outputs.tag_name }}
env:
GH_TOKEN: ${{ github.token }}