CI #16
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: | |
# NOTE: To comment SonarCloud coverage to GitHub Pull Request, we need to run the CI on pull requests. | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- develop | |
- main | |
jobs: | |
test: | |
name: Test and upload coverage to SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5.0.0 | |
with: | |
go-version: 1.22.1 | |
- name: Test with coverage | |
run: go test --tags=test -coverprofile=cover.out $(go list ./... | grep -v mxtransporter/cmd) | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |