Skip to content

refactor: split into tools/foas (library) and tools/cli (binary) #422

refactor: split into tools/foas (library) and tools/cli (binary)

refactor: split into tools/foas (library) and tools/cli (binary) #422

name: 'Code Health FoasCLI'
on:
push:
branches:
- main
paths:
- 'tools/foas/**'
- 'tools/cli/**'
- '.github/workflows/code-health-foascli.yml'
pull_request:
branches:
- main
paths:
- 'tools/foas/**'
- 'tools/cli/**'
- '.github/workflows/code-health-foascli.yml'
workflow_dispatch: {}
workflow_call: {}
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: [foas, cli]
steps:
- name: Checkout CLI
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'tools/${{ matrix.module }}/go.mod'
- name: Build
working-directory: tools/${{ matrix.module }}
run: make build
unit-tests:
needs: build
env:
COVERAGE: coverage.out
UNIT_TAGS: unit
INTEGRATION_TAGS: integration
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
module: [foas, cli]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'tools/${{ matrix.module }}/go.mod'
- name: Run unit tests
working-directory: tools/${{ matrix.module }}
run: make unit-test
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: [foas, cli]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
sparse-checkout: |
.github
tools
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'tools/${{ matrix.module }}/go.mod'
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
- name: golangci-lint
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee
with:
version: v2.10.1
working-directory: tools/${{ matrix.module }}
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub actions
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
sparse-checkout: |
.github
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '20.x'
cache: 'npm'
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
e2e-tests:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'tools/cli/go.mod'
- name: Run e2e tests
working-directory: tools/cli
run: make devtools e2e-test