|
| 1 | +name: 'Code Health FoasCLI' |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + paths: |
| 7 | + - 'tools/cli/**' |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + paths: |
| 12 | + - 'tools/cli/**' |
| 13 | + workflow_dispatch: {} |
| 14 | + workflow_call: {} |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Checkout CLI |
| 24 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 |
| 25 | + - name: Install Go |
| 26 | + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 |
| 27 | + with: |
| 28 | + go-version-file: 'tools/cli/go.mod' |
| 29 | + - name: Build CLI |
| 30 | + working-directory: tools/cli |
| 31 | + run: make build |
| 32 | + unit-tests: |
| 33 | + needs: build |
| 34 | + env: |
| 35 | + COVERAGE: coverage.out |
| 36 | + UNIT_TAGS: unit |
| 37 | + INTEGRATION_TAGS: integration |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 42 | + runs-on: ${{ matrix.os }} |
| 43 | + steps: |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 |
| 46 | + - name: Install Go |
| 47 | + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 |
| 48 | + with: |
| 49 | + go-version-file: 'tools/cli/go.mod' |
| 50 | + - name: Run unit tests |
| 51 | + working-directory: tools/cli |
| 52 | + run: make unit-test |
| 53 | + lint: |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - name: Checkout |
| 57 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 |
| 58 | + with: |
| 59 | + sparse-checkout: | |
| 60 | + .github |
| 61 | + tools |
| 62 | + - name: Install Go |
| 63 | + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 |
| 64 | + with: |
| 65 | + go-version-file: 'tools/cli/go.mod' |
| 66 | + cache: false # see https://github.com/golangci/golangci-lint-action/issues/807 |
| 67 | + - name: golangci-lint |
| 68 | + uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 |
| 69 | + with: |
| 70 | + version: v1.64.5 |
| 71 | + working-directory: tools/cli |
| 72 | + - name: Checkout GitHub actions |
| 73 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 |
| 74 | + with: |
| 75 | + sparse-checkout: | |
| 76 | + .github |
| 77 | + - name: Setup Node |
| 78 | + uses: actions/setup-node@v4 |
| 79 | + with: |
| 80 | + node-version: '20.x' |
| 81 | + cache: 'npm' |
| 82 | + - name: Download actionlint |
| 83 | + id: get_actionlint |
| 84 | + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) |
| 85 | + shell: bash |
| 86 | + - name: Check workflow files |
| 87 | + run: | |
| 88 | + echo "::add-matcher::.github/actionlint-matcher.json" |
| 89 | + ${{ steps.get_actionlint.outputs.executable }} -color |
| 90 | + shell: bash |
| 91 | + e2e-tests: |
| 92 | + needs: build |
| 93 | + runs-on: ubuntu-latest |
| 94 | + steps: |
| 95 | + - name: Checkout |
| 96 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 |
| 97 | + - name: Install Go |
| 98 | + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 |
| 99 | + with: |
| 100 | + go-version-file: 'tools/cli/go.mod' |
| 101 | + - name: Run e2e tests |
| 102 | + working-directory: tools/cli |
| 103 | + run: make e2e-test |
0 commit comments