From d6153be67ad9c28bb26a1cedd78f69f9327aeceb Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 24 Feb 2024 20:15:24 +0100 Subject: [PATCH] ci: Split Lint & Style from Test workflow The Lint & Style job needs to run on all PRs, not only when something "test" related changes. Otherwise not all workflow, nix or other files are style-checked and linted. --- .github/workflows/check.yaml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 7 +++++++ .github/workflows/test.yaml | 16 ---------------- 3 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/check.yaml diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 000000000..e70507906 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,32 @@ +name: Check + +on: + workflow_call: + secrets: + CACHIX_AUTH_TOKEN: + required: false + pull_request: + branches: + - main + - v[0-9]+ + +concurrency: + # Terminate all previous runs of the same workflow for pull requests + group: style-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint-style: + name: Lint & Style + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Nix Environment + uses: ./.github/actions/setup-nix + with: + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + tools: style + - name: Run linter (check locally with `nix-shell --run postgrest-lint`) + run: postgrest-lint + - name: Run style check (auto-format with `nix-shell --run postgrest-style`) + run: postgrest-style-check diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e8233c1f6..11c4b07e2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,6 +14,13 @@ concurrency: cancel-in-progress: true jobs: + check: + name: Check + uses: ./.github/workflows/check.yaml + secrets: + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} + + docs: name: Docs uses: ./.github/workflows/docs.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e9248a93d..89b5f31a3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,22 +30,6 @@ concurrency: cancel-in-progress: true jobs: - lint-style: - name: Lint & Style - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: style - - name: Run linter (check locally with `nix-shell --run postgrest-lint`) - run: postgrest-lint - - name: Run style check (auto-format with `nix-shell --run postgrest-style`) - run: postgrest-style-check - - coverage: name: Coverage runs-on: ubuntu-latest