Skip to content

Commit

Permalink
build(actions): set permissions and timeouts
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <nscuro@protonmail.com>
  • Loading branch information
nscuro committed Apr 11, 2022
1 parent 404f9a3 commit dea6490
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 61 deletions.
81 changes: 43 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,67 @@ name: CI
on:
push:
branches:
- master
- master
pull_request:
branches:
- master
- master

permissions: { }

jobs:
licensecheck:
name: License Check
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3.0.0
- name: Check license headers
uses: apache/skywalking-eyes@v0.2.0
with:
config: .licenserc.yml
- name: Checkout Repository
uses: actions/checkout@v3.0.0
- name: Check license headers
uses: apache/skywalking-eyes@v0.2.0
with:
config: .licenserc.yml

lint:
name: Lint
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3.0.0
- name: Setup Go
uses: actions/setup-go@v3.0.0
with:
go-version: "1.17"
check-latest: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.1.0
with:
version: latest
- name: Checkout Repository
uses: actions/checkout@v3.0.0
- name: Setup Go
uses: actions/setup-go@v3.0.0
with:
go-version: "1.17"
check-latest: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.1.0
with:
version: latest

test:
name: Test
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
matrix:
go:
- "1.15"
- "1.16"
- "1.17"
- "1.15"
- "1.16"
- "1.17"
steps:
- name: Setup Go
uses: actions/setup-go@v3.0.0
with:
go-version: ${{ matrix.go }}
check-latest: true
- name: Setup CycloneDX CLI
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
wget -O "$HOME/.local/bin/cyclonedx" https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.22.0/cyclonedx-linux-x64
echo "ae39404a9dc8b2e7be0a9559781ee9fe3492201d2629de139d702fd4535ffdd6 $HOME/.local/bin/cyclonedx" | sha256sum -c
chmod +x "$HOME/.local/bin/cyclonedx"
- name: Checkout Repository
uses: actions/checkout@v3.0.0
- name: Test
run: make test
- name: Setup Go
uses: actions/setup-go@v3.0.0
with:
go-version: ${{ matrix.go }}
check-latest: true
- name: Setup CycloneDX CLI
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
wget -O "$HOME/.local/bin/cyclonedx" https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.22.0/cyclonedx-linux-x64
echo "ae39404a9dc8b2e7be0a9559781ee9fe3492201d2629de139d702fd4535ffdd6 $HOME/.local/bin/cyclonedx" | sha256sum -c
chmod +x "$HOME/.local/bin/cyclonedx"
- name: Checkout Repository
uses: actions/checkout@v3.0.0
- name: Test
run: make test
51 changes: 28 additions & 23 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
name: goreleaser
name: GoReleaser

on:
push:
tags:
- 'v*'
- 'v*'

permissions:
contents: write

jobs:
goreleaser:
name: Release
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3.0.0
with:
go-version: "1.17"
check-latest: true
- name: Generate SBOM
uses: CycloneDX/gh-gomod-generate-sbom@v1
with:
version: v1
args: mod -licenses -json -output bom.json -type library -verbose
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Repository
uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3.0.0
with:
go-version: "1.17"
check-latest: true
- name: Generate SBOM
uses: CycloneDX/gh-gomod-generate-sbom@v1
with:
version: v1
args: mod -licenses -json -output bom.json -type library -verbose
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit dea6490

Please sign in to comment.