The Wayback Machine - https://web.archive.org/web/20210911024426/https://github.com/arduino/arduino-cli/pull/1388/files
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync testing infrastructure with "template" assets #1388

Merged
merged 7 commits into from Aug 11, 2021
@@ -0,0 +1,177 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-task.md
name: Check Go

env:
# See: https://github.com/actions/setup-go/tree/v2#readme
GO_VERSION: "1.16"

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-go-task.ya?ml"
- "Taskfile.ya?ml"
- "**/go.mod"
- "**/go.sum"
- "**.go"
pull_request:
paths:
- ".github/workflows/check-go-task.ya?ml"
- "Taskfile.ya?ml"
- "**/go.mod"
- "**/go.sum"
- "**.go"
workflow_dispatch:
repository_dispatch:

jobs:
check-errors:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Check for errors
run: task go:vet

check-outdated:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Modernize usages of outdated APIs
run: task go:fix

- name: Check if any fixes were needed
run: git diff --color --exit-code

check-style:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install golint
run: go install golang.org/x/lint/golint@latest

- name: Check style
run: task --silent go:lint

check-formatting:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Format code
run: task go:format

- name: Check formatting
run: git diff --color --exit-code

check-config:
name: check-config (${{ matrix.module.path }})
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
module:
- path: ./
- path: arduino/discovery/discovery_client
- path: client_example
- path: commands/daemon/term_example
- path: docsgen

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Run go mod tidy
working-directory: ${{ matrix.module.path }}
run: go mod tidy

- name: Check whether any tidying was needed
run: git diff --color --exit-code

# Do a simple "smoke test" build for the modules with no other form of validation
build:
name: build (${{ matrix.module.path }})
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
module:
- path: arduino/discovery/discovery_client
- path: client_example
- path: commands/daemon/term_example

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Build
working-directory: ${{ matrix.module.path }}
run: go build
@@ -0,0 +1,51 @@
name: Check Internationalization

env:
# See: https://github.com/actions/setup-go/tree/v2#readme
GO_VERSION: "1.16"

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-i18n-task.ya?ml"
- "Taskfile.ya?ml"
- "go.mod"
- "go.sum"
- "**.go"
- "i18n/**"
pull_request:
paths:
- ".github/workflows/check-i18n-task.ya?ml"
- "Taskfile.ya?ml"
- "go.mod"
- "go.sum"
- "**.go"
- "i18n/**"
workflow_dispatch:
repository_dispatch:

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install go.rice
run: go get github.com/cmaglie/go.rice/rice

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Check for errors
run: task i18n:check
@@ -0,0 +1,81 @@
name: Check Protocol Buffers

env:
# See: https://github.com/actions/setup-go/tree/v2#readme
GO_VERSION: "1.16"

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-protobuf-task.ya?ml"
- "Taskfile.ya?ml"
- "rpc/**"
pull_request:
paths:
- ".github/workflows/check-protobuf-task.ya?ml"
- "Taskfile.ya?ml"
- "rpc/**"
workflow_dispatch:
repository_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install protoc compiler
uses: arduino/setup-protoc@v1
with:
version: v3.16.0
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Go deps
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Check protocol buffers compile correctly
if: runner.os == 'Linux'
run: task protoc:compile

check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install buf (protoc linter)
run: |
go install github.com/bufbuild/buf/cmd/buf@latest
go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@latest
go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@latest
- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Lint protocol buffers
run: task protoc:check