From 660f94150ed92b275c19a67f16829c20902dcaef Mon Sep 17 00:00:00 2001 From: danijelTxFusion Date: Wed, 28 Feb 2024 10:33:54 +0100 Subject: [PATCH] ci: fix validation pipeline and add paths --- .github/workflows/{test-go.yml => go.yml} | 21 +++++++++--- .github/workflows/{test-js.yml => js.yml} | 23 +++++++++++-- .github/workflows/validate.yml | 42 ++++------------------- 3 files changed, 44 insertions(+), 42 deletions(-) rename .github/workflows/{test-go.yml => go.yml} (59%) rename .github/workflows/{test-js.yml => js.yml} (60%) diff --git a/.github/workflows/test-go.yml b/.github/workflows/go.yml similarity index 59% rename from .github/workflows/test-go.yml rename to .github/workflows/go.yml index 40d21a6..eb38d7e 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/go.yml @@ -1,9 +1,10 @@ -name: Run tests Go +name: Go on: workflow_dispatch: pull_request: - branch: main + branches: [main] types: [ opened, reopened, synchronize ] + paths: [go] permissions: contents: read # for checkout @@ -14,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Go @@ -28,4 +29,16 @@ jobs: docker-compose up -d popd - name: Run tests - run: cd go && make run-tests \ No newline at end of file + run: cd go && make run-tests + lint: + name: Check code format for Go + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Go + uses: actions/setup-go@v4.0.0 + - name: Run gofmt + run: cd go && make check-format \ No newline at end of file diff --git a/.github/workflows/test-js.yml b/.github/workflows/js.yml similarity index 60% rename from .github/workflows/test-js.yml rename to .github/workflows/js.yml index c06db96..77364f3 100644 --- a/.github/workflows/test-js.yml +++ b/.github/workflows/js.yml @@ -2,23 +2,40 @@ name: Run tests JS on: workflow_dispatch: pull_request: - branch: main + branches: [main] types: [ opened, reopened, synchronize ] + paths: [js] permissions: contents: read # for checkout jobs: + lint: + name: Check code format for JavaScript + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + - name: Install dependencies + run: cd js && yarn install + - name: Prepare environment + run: cd js && yarn lint:check test: name: Test runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "lts/*" - name: Install dependencies diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 79f1f73..1e6cda8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,54 +1,26 @@ name: Validate on: pull_request: - branch: main + branches: [main] types: [ opened, reopened, synchronize ] permissions: contents: read # for checkout jobs: - lint-go: - name: Check code format for Go - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install Go - uses: actions/setup-go@v4.0.0 - - name: Run gofmt - run: cd go && make check-format - lint-js: - name: Check code format for JavaScript - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "lts/*" - - name: Install dependencies - run: cd js && yarn install - - name: Prepare environment - run: cd js && yarn lint:check commits: name: Check commits runs-on: ubuntu-latest if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "lts/*" - name: Install dependencies - run: npm install -g @commitlint/cli @commitlint/config-conventional + run: npm install -g @commitlint/cli@18.6.1 @commitlint/config-conventional@18.6.2 - name: Configure run: | echo 'module.exports = {"extends": ["@commitlint/config-conventional"]}' > commitlint.config.js @@ -65,13 +37,13 @@ jobs: if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "lts/*" - name: Install dependencies - run: npm install -g @commitlint/cli @commitlint/config-conventional + run: npm install -g @commitlint/cli@18.6.1 @commitlint/config-conventional@18.6.2 - name: Configure run: | echo 'module.exports = {"extends": ["@commitlint/config-conventional"]}' > commitlint.config.js