--- name: Reusable unit test Workflow on: workflow_call: inputs: runs-on: required: false type: string default: ubuntu-latest targets: required: false type: string default: "['linux-unit-test-1-cpu','linux-unit-test-2-cpu','linux-unit-test-4-cpu']" permissions: read-all jobs: test-linux: strategy: fail-fast: false matrix: target: ${{ fromJSON(inputs.targets) }} runs-on: ${{ inputs.runs-on }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - id: goversion run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version: ${{ steps.goversion.outputs.goversion }} - run: make fmt - env: TARGET: ${{ matrix.target }} run: | case "${TARGET}" in linux-unit-test-1-cpu) CPU=1 make test ;; linux-unit-test-2-cpu) CPU=2 make test ;; linux-unit-test-4-cpu) CPU=4 make test ;; linux-unit-test-4-cpu-race) CPU=4 ENABLE_RACE=true make test ;; *) echo "Failed to find target" exit 1 ;; esac - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: version: v2.1.6