From 721dea9eebb2015f43c0cc3457c46ec0a2bc3789 Mon Sep 17 00:00:00 2001 From: Reece Williams <31943163+Reecepbcups@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:52:43 -0500 Subject: [PATCH] move workflows to standalone files (#116) * moves CI to individual files (WIP: path based actions) * enable conditional paths for workflows --- .github/workflows/async-icq.yml | 42 +++++++++++++++++++ .github/workflows/golangci-lint.yaml | 30 ------------- .github/workflows/ibc-hooks.yml | 40 ++++++++++++++++++ .../workflows/packet-forward-middleware.yml | 42 +++++++++++++++++++ tools/resolve-modules.sh | 9 ---- 5 files changed, 124 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/async-icq.yml delete mode 100644 .github/workflows/golangci-lint.yaml create mode 100644 .github/workflows/ibc-hooks.yml create mode 100644 .github/workflows/packet-forward-middleware.yml delete mode 100755 tools/resolve-modules.sh diff --git a/.github/workflows/async-icq.yml b/.github/workflows/async-icq.yml new file mode 100644 index 00000000..dbd1dcba --- /dev/null +++ b/.github/workflows/async-icq.yml @@ -0,0 +1,42 @@ +name: async-icq +on: + pull_request: + paths: + - 'modules/async-icq/**' + - '.github/workflows/async-icq.yml' + +env: + LINT_VERSION: v1.52 + GO_VERSION: 1.21.0 + WORKING_DIRECTORY: modules/async-icq/ + +jobs: + golangci: + name: Linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: ${{ env.LINT_VERSION }} + working-directory: ${{ env.WORKING_DIRECTORY }} + args: --timeout=5m + + test: + runs-on: ubuntu-latest + name: test + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - uses: actions/checkout@v4 + + - name: Test + run: go test ./... + working-directory: ${{ env.WORKING_DIRECTORY }} + + # TODO: e2e \ No newline at end of file diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml deleted file mode 100644 index c2883b12..00000000 --- a/.github/workflows/golangci-lint.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: golangci-lint -on: - pull_request: - -jobs: - resolve-modules: - name: Resolve Modules - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - name: Checkout Sources - uses: actions/checkout@v3 - - id: set-matrix - run: ./tools/resolve-modules.sh - golangci: - name: Linter - needs: resolve-modules - runs-on: ubuntu-latest - strategy: - matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }} - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v2 - with: - version: v1.52 - working-directory: ${{ matrix.workdir }} - args: --timeout=5m \ No newline at end of file diff --git a/.github/workflows/ibc-hooks.yml b/.github/workflows/ibc-hooks.yml new file mode 100644 index 00000000..231dedf8 --- /dev/null +++ b/.github/workflows/ibc-hooks.yml @@ -0,0 +1,40 @@ +name: ibc-hooks +on: + pull_request: + paths: + - 'modules/ibc-hooks/**' + - '.github/workflows/ibc-hooks.yml' + +env: + LINT_VERSION: v1.52 + GO_VERSION: 1.21.0 + WORKING_DIRECTORY: modules/ibc-hooks/ + +jobs: + golangci: + name: Linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: ${{ env.LINT_VERSION }} + working-directory: ${{ env.WORKING_DIRECTORY }} + args: --timeout=5m + + test: + runs-on: ubuntu-latest + name: test + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - uses: actions/checkout@v4 + + - name: Test + run: go test ./... + working-directory: ${{ env.WORKING_DIRECTORY }} \ No newline at end of file diff --git a/.github/workflows/packet-forward-middleware.yml b/.github/workflows/packet-forward-middleware.yml new file mode 100644 index 00000000..d05f7d3b --- /dev/null +++ b/.github/workflows/packet-forward-middleware.yml @@ -0,0 +1,42 @@ +name: packet-forward-middleware +on: + pull_request: + paths: + - 'middleware/packet-forward-middleware/**' + - '.github/workflows/packet-forward-middleware.yml' + +env: + LINT_VERSION: v1.52 + GO_VERSION: 1.21.0 + WORKING_DIRECTORY: middleware/packet-forward-middleware/ + +jobs: + golangci: + name: Linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: ${{ env.LINT_VERSION }} + working-directory: ${{ env.WORKING_DIRECTORY }} + args: --timeout=5m + + test: + runs-on: ubuntu-latest + name: test + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - uses: actions/checkout@v4 + + - name: Test + run: go test ./... + working-directory: ${{ env.WORKING_DIRECTORY }} + + # TODO: e2e \ No newline at end of file diff --git a/tools/resolve-modules.sh b/tools/resolve-modules.sh deleted file mode 100755 index e4465888..00000000 --- a/tools/resolve-modules.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# Recursively finds all directories with a go.mod file and creates -# a GitHub Actions JSON output option. This is used by the linter action. -# Credit: https://github.com/golangci/golangci-lint/issues/828#issuecomment-658207652 - -echo "Resolving modules in $(pwd)" - -PATHS=$(find . -mindepth 2 -not -path "*/e2e/*" -type f -name go.mod -printf '{"workdir":"%h"},') -echo "::set-output name=matrix::{\"include\":[${PATHS%?}]}" \ No newline at end of file