Bump actions/upload-artifact from 3 to 4 #31
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
pull_request: | |
branches: | |
- "**" | |
push: | |
branches: | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Load cached dependencies | |
id: cached-go-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: go-${{ inputs.go_version }}-v1.0-${{ hashFiles('**/go.sum') }} | |
- name: Install dependencies | |
if: steps.cached-go-dependencies.outputs.cache-hit != 'true' | |
shell: bash | |
run: go get -v -t ./... | |
analyze: | |
needs: setup | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Load cached dependencies | |
id: cached-go-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: go-${{ inputs.go_version }}-v1.0-${{ hashFiles('**/go.sum') }} | |
- name: Install dependencies | |
if: steps.cached-go-dependencies.outputs.cache-hit != 'true' | |
shell: bash | |
run: go get -v -t ./... | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: go | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
lint: | |
needs: setup | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Load cached dependencies | |
id: cached-go-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: go-${{ inputs.go_version }}-v1.0-${{ hashFiles('**/go.sum') }} | |
- name: Install dependencies | |
if: steps.cached-go-dependencies.outputs.cache-hit != 'true' | |
shell: bash | |
run: go get -v -t ./... | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
continue-on-error: true | |
with: | |
version: v1.53 | |
skip-go-installation: true | |
skip-pkg-cache: true | |
skip-build-cache: true | |
test: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Load cached dependencies | |
id: cached-go-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: go-${{ inputs.go_version }}-v1.0-${{ hashFiles('**/go.sum') }} | |
- name: Install dependencies | |
if: steps.cached-go-dependencies.outputs.cache-hit != 'true' | |
shell: bash | |
run: go get -v -t ./... | |
- name: Run Tests | |
run: go test -coverprofile=coverage.out ./... | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: ./coverage.out | |
sonarcloud: | |
needs: [test, lint, analyze] | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download Coverage Report | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage-report | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |