Skip to content

ci: list modules and pass it to test matrix #16

ci: list modules and pass it to test matrix

ci: list modules and pass it to test matrix #16

Workflow file for this run

name: main
concurrency:
group: main-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
tags-ignore:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:
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.21.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.21.0'
only-module-list: true
test-modules:
needs: list-modules
if: ${{ always() }}
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{ fromJson(needs.list-modules.outputs.modules) }}
fail-fast: false
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.21.0'
# - name: Check if coverage data exists
# if: success() || failure()
# id: check-coverage
# working-directory: ./${{ matrix.package }}
# run: |
# if [ $(wc -l <coverage.out) -gt 1 ]; then
# echo "::set-output name=coverage_data_exists::true"
# else
# echo "::set-output name=coverage_data_exists::false"
# fi
# - name: upload coverage
# if: steps.check-coverage.outputs.coverage_data_exists == 'true'
# uses: coverallsapp/github-action@v2
# with:
# flag-name: ${{ matrix.package == './' && 'happy' || matrix.package }}
# parallel: true
# github-token: ${{ secrets.GITHUB_TOKEN }}
# file: ./${{ matrix.package }}/coverage.out
# finish:
# needs: test
# if: ${{ always() }}
# runs-on: ubuntu-latest
# steps:
# - name: Coveralls Finish
# uses: coverallsapp/github-action@v2
# with:
# parallel-finished: true