Merge pull request #233 from arduino/dependabot/go_modules/github.com… #162
This file contains hidden or 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
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/test-go-task.md | |
name: Test Go | |
env: | |
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax | |
GO_VERSION: "1.17" | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows | |
on: | |
push: | |
paths: | |
- ".github/workflows/test-go-task.ya?ml" | |
- "codecov.ya?ml" | |
- "**/go.mod" | |
- "**/go.sum" | |
- "Taskfile.ya?ml" | |
- "**.go" | |
- "**/testdata/**" | |
pull_request: | |
paths: | |
- ".github/workflows/test-go-task.ya?ml" | |
- "codecov.ya?ml" | |
- "**/go.mod" | |
- "**/go.sum" | |
- "Taskfile.ya?ml" | |
- "**.go" | |
- "**/testdata/**" | |
workflow_dispatch: | |
repository_dispatch: | |
jobs: | |
test: | |
name: test (${{ matrix.module.path }} - ${{ matrix.operating-system }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: | |
- ubuntu-latest | |
module: | |
- path: ./ | |
codecov-flags: unit | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: 3.x | |
- name: Run tests | |
env: | |
GO_MODULE_PATH: ${{ matrix.module.path }} | |
run: task go:test | |
- name: Send unit tests coverage to Codecov | |
if: matrix.operating-system == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ${{ matrix.module.path }}coverage_unit.txt | |
flags: ${{ matrix.module.codecov-flags }} | |
fail_ci_if_error: ${{ github.repository == 'arduino/library-registry-submission-parser' }} |