From 158f71d2e68138f7f2526aa0cc368188f894a7eb Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Tue, 18 Mar 2025 12:25:55 +0000 Subject: [PATCH 1/3] chore: separate code health gh action per tools to run only when specific paths are changed --- .github/workflows/code-health-foascli.yml | 94 +++++++++++++++++++++++ .github/workflows/code-health-tools.yml | 64 +-------------- 2 files changed, 96 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/code-health-foascli.yml diff --git a/.github/workflows/code-health-foascli.yml b/.github/workflows/code-health-foascli.yml new file mode 100644 index 0000000000..1fdfa1e1b7 --- /dev/null +++ b/.github/workflows/code-health-foascli.yml @@ -0,0 +1,94 @@ +name: 'Code Health FoasCLI' +on: + push: + branches: + - main + paths: + - 'tools/cli/**' + pull_request: {} + workflow_dispatch: {} + workflow_call: {} + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout CLI + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - name: Install Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 + with: + go-version-file: 'tools/cli/go.mod' + - name: Build CLI + working-directory: tools/cli + 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, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - name: Install Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 + with: + go-version-file: 'tools/cli/go.mod' + - name: Run unit tests + working-directory: tools/cli + run: make unit-test + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + sparse-checkout: | + .github + tools + - name: Install Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 + with: + go-version-file: 'tools/cli/go.mod' + cache: false # see https://github.com/golangci/golangci-lint-action/issues/807 + - name: golangci-lint + uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 + with: + version: v1.64.5 + working-directory: tools/cli + - name: Checkout GitHub actions + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + sparse-checkout: | + .github + - 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@692973e3d937129bcbf40652eb9f2f61becf3332 + - name: Install Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 + with: + go-version-file: 'tools/cli/go.mod' + - name: Run e2e tests + working-directory: tools/cli + run: make e2e-test diff --git a/.github/workflows/code-health-tools.yml b/.github/workflows/code-health-tools.yml index b1e900b9f7..598650e35f 100644 --- a/.github/workflows/code-health-tools.yml +++ b/.github/workflows/code-health-tools.yml @@ -4,7 +4,8 @@ on: branches: - main paths: - - 'tools/**' + - 'tools/postman/**' + - 'tools/spectral/**' pull_request: {} workflow_dispatch: {} workflow_call: {} @@ -13,39 +14,6 @@ permissions: contents: read jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout CLI - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - - name: Install Go - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 - with: - go-version-file: 'tools/cli/go.mod' - - name: Build CLI - working-directory: tools/cli - 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, windows-latest, macos-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - - name: Install Go - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 - with: - go-version-file: 'tools/cli/go.mod' - - name: Run unit tests - working-directory: tools/cli - run: make unit-test js-tests: runs-on: ubuntu-latest steps: @@ -95,21 +63,6 @@ jobs: exit 1 fi exit 0 - - name: Install Go - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 - with: - go-version-file: 'tools/cli/go.mod' - cache: false # see https://github.com/golangci/golangci-lint-action/issues/807 - - name: golangci-lint - uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 - with: - version: v1.64.5 - working-directory: tools/cli - - name: Checkout GitHub actions - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - sparse-checkout: | - .github - name: Download actionlint id: get_actionlint run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) @@ -119,16 +72,3 @@ jobs: 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@692973e3d937129bcbf40652eb9f2f61becf3332 - - name: Install Go - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 - with: - go-version-file: 'tools/cli/go.mod' - - name: Run e2e tests - working-directory: tools/cli - run: make e2e-test From cccc95a40029a606ba99894e96d7a8f7a8cbf20f Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Tue, 18 Mar 2025 12:27:29 +0000 Subject: [PATCH 2/3] added paths --- .github/workflows/code-health-foascli.yml | 6 +++++- .github/workflows/code-health-tools.yml | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-health-foascli.yml b/.github/workflows/code-health-foascli.yml index 1fdfa1e1b7..78b4952739 100644 --- a/.github/workflows/code-health-foascli.yml +++ b/.github/workflows/code-health-foascli.yml @@ -5,7 +5,11 @@ on: - main paths: - 'tools/cli/**' - pull_request: {} + pull_request: + branches: + - main + paths: + - 'tools/cli/**' workflow_dispatch: {} workflow_call: {} diff --git a/.github/workflows/code-health-tools.yml b/.github/workflows/code-health-tools.yml index 598650e35f..1748e51c14 100644 --- a/.github/workflows/code-health-tools.yml +++ b/.github/workflows/code-health-tools.yml @@ -6,7 +6,12 @@ on: paths: - 'tools/postman/**' - 'tools/spectral/**' - pull_request: {} + pull_request: + branches: + - main + paths: + - 'tools/postman/**' + - 'tools/spectral/**' workflow_dispatch: {} workflow_call: {} From bd39eff36c965dff1914ccff7a7526f78f66834b Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Tue, 18 Mar 2025 12:34:19 +0000 Subject: [PATCH 3/3] added node as it is needed for actionlint --- .github/workflows/code-health-foascli.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/code-health-foascli.yml b/.github/workflows/code-health-foascli.yml index 78b4952739..e17b168dd6 100644 --- a/.github/workflows/code-health-foascli.yml +++ b/.github/workflows/code-health-foascli.yml @@ -74,6 +74,11 @@ jobs: with: sparse-checkout: | .github + - name: Setup Node + uses: actions/setup-node@v4 + 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)