Skip to content

improvements #566 #570 #2031

improvements #566 #570

improvements #566 #570 #2031

Workflow file for this run

---
# Copyright 2022
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Check Tests and Documentation
# yamllint disable-line rule:truthy
on:
push:
branches:
- master
pull_request:
branches:
- master
- issue-99-cosmos-upgrade-v0.44
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
go: ${{ steps.filter.outputs.go }}
src: ${{ steps.filter.outputs.src }}
docs: ${{ steps.filter.outputs.docs }}
workflows: ${{ steps.filter.outputs.workflows }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
if: ${{ !env.ACT }}
id: filter
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
go:
- '**/*.go'
- 'go.mod'
- 'go.sum'
src:
- '!((**.md)|(**/*.md)|(.github/**)|(docs/**)|(vue/**))'
docs:
- '**.md'
- '**/*.md'
workflows:
- '.github/**'
gh-actions:
if: needs.changes.outputs.workflows == 'true'
name: Run actionlint tool to verify lint issues in GitHub actions
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@master
- uses: reviewdog/action-actionlint@v1
links:
if: needs.changes.outputs.docs == 'true'
name: Run markdown-link-check tool to verify link issues
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
spell:
if: needs.changes.outputs.docs == 'true'
name: Run PySpelling tool to verify spelling issues
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@v3
- uses: rojopolis/spellcheck-github-actions@0.24.0
unit-tests:
name: Check unit tests
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/setup-go@v4
with:
go-version: ^1.20
- uses: actions/checkout@v3
- uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: haveyoudebuggedit/gotestfmt-action@v2
- name: Run tests
run: |
set -euo pipefail
# shellcheck disable=SC2046
go test -json -v $(go list ./... | grep -v '/integration_tests') 2>&1 | tee /tmp/gotest.log | gotestfmt
integration-tests:
if: needs.changes.outputs.src == 'true'
name: Integration tests
runs-on: ubuntu-20.04
needs:
- changes
steps:
- uses: actions/setup-go@v4
with:
go-version: ^1.20
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run integration tests
shell: bash
run: integration_tests/run-all.sh
lint:
if: needs.changes.outputs.go == 'true'
name: Check linter issues with golangci-lint tool
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.21
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55
args: --timeout 5m0s
check:
if: always()
needs:
- unit-tests
- integration-tests
- lint
- links
- spell
- gh-actions
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-skips: lint, unit-tests, integration-tests, links, spell, gh-actions
jobs: ${{ toJSON(needs) }}