From dde5d344ebabae6badb77c7554ceba501904cc38 Mon Sep 17 00:00:00 2001 From: Isla Koenigsknecht Date: Tue, 7 May 2024 15:14:21 -0400 Subject: [PATCH] Update required contextual actions to run and exit early when no relevant changes found (#2488) --- .github/workflows/backend-tests.yml | 50 ++++++++++++++++++- .../check-desktop-visual-regression.yml | 18 ++++++- .github/workflows/desktop-rtl-tests.yml | 20 ++++++-- .github/workflows/desktop-test-scroll.yml | 22 ++++++-- .github/workflows/desktop-tests.yml | 18 ++++++- .github/workflows/identity-tests.yml | 18 ++++++- .github/workflows/state-manager-tests.yml | 18 ++++++- CHANGELOG.md | 1 + 8 files changed, 149 insertions(+), 16 deletions(-) diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index 8235f50d28..cfbb49e884 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -2,8 +2,6 @@ name: Backend unit tests on: pull_request: - paths: - - packages/backend/** jobs: unit-tests: @@ -14,17 +12,33 @@ jobs: os: [ubuntu-20.04, macos-latest, windows-2019] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + backend: + - 'packages/backend/**' + - name: "Skip tests" + if: steps.filter.outputs.backend == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.backend == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.backend == 'true' - name: "Setup environment" + if: steps.filter.outputs.backend == 'true' uses: ./.github/actions/setup-env with: bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,backend-bundle" - name: "Unit tests" + if: steps.filter.outputs.backend == 'true' run: lerna run test-ci --scope @quiet/backend --stream long-running-tests: @@ -35,17 +49,33 @@ jobs: os: [ubuntu-20.04] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + backend: + - 'packages/backend/**' + - name: "Skip tests" + if: steps.filter.outputs.backend == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.backend == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.backend == 'true' - name: "Setup environment" + if: steps.filter.outputs.backend == 'true' uses: ./.github/actions/setup-env with: bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,backend-bundle" - name: "Unit tests" + if: steps.filter.outputs.backend == 'true' run: lerna run test-ci-long-running --scope @quiet/backend --stream unit-tests-with-tor: @@ -56,15 +86,31 @@ jobs: os: [ubuntu-20.04] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + backend: + - 'packages/backend/**' + - name: "Skip tests" + if: steps.filter.outputs.backend == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.backend == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.backend == 'true' - name: "Setup environment" + if: steps.filter.outputs.backend == 'true' uses: ./.github/actions/setup-env with: bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,backend-bundle" - name: "Unit tests" + if: steps.filter.outputs.backend == 'true' run: lerna run test-ci-tor --scope @quiet/backend --stream diff --git a/.github/workflows/check-desktop-visual-regression.yml b/.github/workflows/check-desktop-visual-regression.yml index 3b8599420c..7ecc4123e0 100644 --- a/.github/workflows/check-desktop-visual-regression.yml +++ b/.github/workflows/check-desktop-visual-regression.yml @@ -2,8 +2,6 @@ name: Desktop visual regressions on: pull_request: - paths: - - packages/desktop/** jobs: chromatic-deployment: @@ -14,20 +12,36 @@ jobs: os: [ubuntu-20.04] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + desktop: + - 'packages/desktop/**' + - name: "Skip tests" + if: steps.filter.outputs.desktop == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.desktop == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.desktop == 'true' with: fetch-depth: 0 # Required to retrieve git history - name: Setup environment uses: ./.github/actions/setup-env + if: steps.filter.outputs.desktop == 'true' with: bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Publish to Chromatic" uses: chromaui/action@355e2a05a179e9e89c2b237dcd55adbeb89e577e # v1 + if: steps.filter.outputs.desktop == 'true' with: workingDir: ./packages/desktop token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/desktop-rtl-tests.yml b/.github/workflows/desktop-rtl-tests.yml index 8e8343b736..0ceb2042a4 100644 --- a/.github/workflows/desktop-rtl-tests.yml +++ b/.github/workflows/desktop-rtl-tests.yml @@ -2,9 +2,6 @@ name: Desktop - state-manager bracket tests (RTL) on: pull_request: - paths: - - packages/desktop/** - - packages/state-manager/** jobs: desktop-tests: @@ -16,16 +13,33 @@ jobs: os: [ubuntu-20.04, macos-latest] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + validFiles: + - 'packages/desktop/**' + - 'packages/state-manger/**' + - name: "Skip tests" + if: steps.filter.outputs.validFiles == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.validFiles == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@v3 + if: steps.filter.outputs.validFiles == 'true' - name: "Setup environment" uses: ./.github/actions/setup-env + if: steps.filter.outputs.validFiles == 'true' with: cachePrefix: "desktop-tests" bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Desktop - state-manager bracket tests" + if: steps.filter.outputs.validFiles == 'true' run: lerna run rtl-test --scope @quiet/desktop --stream diff --git a/.github/workflows/desktop-test-scroll.yml b/.github/workflows/desktop-test-scroll.yml index 0ee999eb78..9f1c0b9ee0 100644 --- a/.github/workflows/desktop-test-scroll.yml +++ b/.github/workflows/desktop-test-scroll.yml @@ -2,8 +2,6 @@ name: Desktop scroll regression tests on: pull_request: - paths: - - packages/desktop/** jobs: regression-tests: @@ -15,31 +13,49 @@ jobs: os: [ubuntu-20.04] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + desktop: + - 'packages/desktop/**' + - name: "Skip tests" + if: steps.filter.outputs.desktop == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.desktop == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.desktop == 'true' - name: Setup environment uses: ./.github/actions/setup-env + if: steps.filter.outputs.desktop == 'true' with: bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Install libs" + if: steps.filter.outputs.desktop == 'true' run: sudo apt-get update && sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb - name: "Remove test files workaround" + if: steps.filter.outputs.desktop == 'true' run: find packages/desktop/src -name '*.test.*' -delete && find packages/backend/src -name '*.test.*' -delete - uses: cypress-io/github-action@1b70233146622b69e789ccdd4f9452adc638d25a # v6.6.1 + if: steps.filter.outputs.desktop == 'true' with: install: false command: npm run regression-test:ci working-directory: packages/desktop - name: Archive test screenshots + if: steps.filter.outputs.desktop == 'true' uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() with: name: test-screenshots-linux path: packages/desktop/cypress/snapshots diff --git a/.github/workflows/desktop-tests.yml b/.github/workflows/desktop-tests.yml index 38fbf3592f..5af62b1a81 100644 --- a/.github/workflows/desktop-tests.yml +++ b/.github/workflows/desktop-tests.yml @@ -2,8 +2,6 @@ name: Desktop tests on: pull_request: - paths: - - packages/desktop/** jobs: desktop-tests: @@ -15,16 +13,32 @@ jobs: os: [ubuntu-20.04, macos-latest] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + desktop: + - 'packages/desktop/**' + - name: "Skip tests" + if: steps.filter.outputs.desktop == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.desktop == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.desktop == 'true' - name: "Setup environment" uses: ./.github/actions/setup-env + if: steps.filter.outputs.desktop == 'true' with: cachePrefix: "desktop-tests" bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Unit tests" + if: steps.filter.outputs.desktop == 'true' run: lerna run test --scope @quiet/desktop --stream diff --git a/.github/workflows/identity-tests.yml b/.github/workflows/identity-tests.yml index ea66be2b38..2c156c1c43 100644 --- a/.github/workflows/identity-tests.yml +++ b/.github/workflows/identity-tests.yml @@ -2,8 +2,6 @@ name: Identity tests on: pull_request: - paths: - - packages/identity/** jobs: identity-tests: @@ -15,15 +13,31 @@ jobs: os: [ubuntu-20.04, macos-latest, windows-2019] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + identity: + - 'packages/identity/**' + - name: "Skip tests" + if: steps.filter.outputs.identity == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.identity == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.identity == 'true' - name: "Setup environment" uses: ./.github/actions/setup-env + if: steps.filter.outputs.identity == 'true' with: bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/types,@quiet/identity,backend-bundle" - name: "Unit tests" + if: steps.filter.outputs.identity == 'true' run: lerna run test --scope @quiet/identity --stream diff --git a/.github/workflows/state-manager-tests.yml b/.github/workflows/state-manager-tests.yml index cd68e78a5b..c7fa0bf0bd 100644 --- a/.github/workflows/state-manager-tests.yml +++ b/.github/workflows/state-manager-tests.yml @@ -2,8 +2,6 @@ name: State-manager tests on: pull_request: - paths: - - packages/state-manager/** jobs: state-manager-tests: @@ -15,15 +13,31 @@ jobs: os: [ubuntu-20.04, macos-latest] steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + stateManager: + - 'packages/state-manager/**' + - name: "Skip tests" + if: steps.filter.outputs.stateManager == 'false' + run: | + echo "Skipping test run" + exit 0 + - name: "Print OS" + if: steps.filter.outputs.stateManager == 'true' run: echo ${{ matrix.os }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: steps.filter.outputs.stateManager == 'true' - name: "Setup environment" uses: ./.github/actions/setup-env + if: steps.filter.outputs.stateManager == 'true' with: bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Unit tests" + if: steps.filter.outputs.stateManager == 'true' run: lerna run test --scope @quiet/state-manager --stream diff --git a/CHANGELOG.md b/CHANGELOG.md index 3512ab6d81..dbfe219b55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ # Fixes: +* Update github workflows for PR gating ([#2487](https://github.com/TryQuiet/quiet/issues/2487)) * Don't create duplicate CSRs when joining a community under certain circumstances ([#2321](https://github.com/TryQuiet/quiet/issues/2321)) [2.2.0]