Merge pull request #138 from asphaltbuffet/dependabot/go_modules/gith… #259
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Main Workflow | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
ci: | |
name: Build and Test | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-20.04, macos-11, windows-2022] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.18 | |
- name: Build | |
run: make ci | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: bin | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
file: ./bin/coverage.out | |
flags: ${{ runner.os }} | |
sonarCloudTrigger: | |
needs: ci | |
name: SonarCloud Trigger | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Download code coverage results | |
uses: actions/download-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: bin | |
- name: Analyze with SonarCloud | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
release-test: | |
needs: ci | |
name: Release Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all tags | |
run: git fetch --force --tags | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.18 | |
- name: Run GoReleaser - snapshot | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
# either 'goreleaser' (default) or 'goreleaser-pro' | |
distribution: goreleaser | |
version: latest | |
args: release --snapshot --skip-publish --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution | |
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
- name: Archive dist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: snapshot | |
path: dist |