feat: merge config reset commands #167
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: monorepo-main | |
concurrency: | |
group: main-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- 'main' | |
tags-ignore: | |
- '*' | |
pull_request: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
inputs: | |
loose: | |
description: 'Set to false to make the workflow continue on error' | |
required: false | |
default: 'true' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lint all packages | |
uses: ./.github/actions/golangci-lint-monorepo-action | |
with: | |
go-version: '>=1.22.0' | |
golangci-lint-version: latest | |
list-modules: | |
needs: lint | |
runs-on: ubuntu-latest | |
outputs: | |
modules: ${{ steps.modulelist.outputs.modules }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get monorepo modules | |
id: modulelist | |
uses: ./.github/actions/go-test-monorepo-action | |
with: | |
go-version: '>=1.22.0' | |
only-module-list: true | |
test-n-coverage: | |
needs: list-modules | |
strategy: | |
matrix: | |
module: ${{ fromJson(needs.list-modules.outputs.modules) }} | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
fail-fast: ${{ github.event.inputs.loose != 'true' }} | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run tests and generate coverage reports | |
id: modulelist | |
uses: ./.github/actions/go-test-monorepo-action | |
with: | |
go-version: '>=1.22.0' | |
race: ${{ github.event.inputs.loose != 'true' }} | |
fail-fast: ${{ github.event.inputs.loose != 'true' }} | |
continue-on-error: ${{ github.event.inputs.loose == 'true' }} | |
- name: Check if coverage data exists | |
if: github.event.inputs.loose == 'true' || success() | |
id: check-coverage | |
working-directory: ${{ matrix.module }} | |
run: | | |
if [[ -f coverage.out && $(wc -l <coverage.out) -gt 1 ]]; then | |
echo "coverage_data_exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "coverage_data_exists=false" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Prepare flag name | |
id: prepare-flag | |
run: | | |
module_path="${{ matrix.module }}" | |
if [ "$module_path" == "." ]; then | |
clean_module_name="happy" | |
else | |
clean_module_name="${module_path#./}" | |
fi | |
echo "clean_module_name=$clean_module_name" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Upload coverage | |
if: steps.check-coverage.outputs.coverage_data_exists == 'true' | |
uses: coverallsapp/github-action@v2 | |
with: | |
flag-name: ${{ steps.prepare-flag.outputs.clean_module_name }} | |
parallel: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ matrix.module }}/coverage.out | |
finish-coverage-report: | |
needs: test-n-coverage | |
if: github.event.inputs.loose == 'true' || success() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finish | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true |