Forráskód Böngészése

Split Frontend and Python Unit tests (#3399)

* Split Frontend and Python Unit tests

* Extra comment for deploy docs workflow

* Simpler comment

* Add paths and paths-ignore to unit tests

* More specific comment for py unit tests

* Remove paths-ignore because jobs are required

---------

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
mamoodi 1 éve
szülő
commit
340fe0de18

+ 2 - 0
.github/workflows/deploy-docs.yml

@@ -7,6 +7,8 @@ concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
   cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
 
+# * Always run on "main"
+# * Run on PRs that target the "main" branch and have changes in the "docs" folder
 on:
   push:
     branches:

+ 39 - 0
.github/workflows/fe-unit-tests.yml

@@ -0,0 +1,39 @@
+# Workflow that runs frontend unit tests
+name: Run Frontend Unit Tests
+
+# * Always run on "main"
+# * Run on PRs that have changes in the "frontend" folder or this workflow
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+    paths:
+      - 'frontend/**'
+      -  '.github/workflows/fe-unit-tests.yml'
+
+jobs:
+  # Run frontend unit tests
+  fe-test:
+    name: FE Unit Tests
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        node-version: [20]
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: Set up Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: ${{ matrix.node-version }}
+      - name: Install dependencies
+        working-directory: ./frontend
+        run: npm ci
+      - name: Run tests and collect coverage
+        working-directory: ./frontend
+        run: npm run test:coverage
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v4
+        env:
+          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

+ 7 - 40
.github/workflows/run-unit-tests.yml → .github/workflows/py-unit-tests.yml

@@ -1,52 +1,19 @@
-# Workflow that runs frontend and python unit tests
-name: Run Unit Tests
-
-# Only run one workflow of the same group at a time.
-# There can be at most one running and one pending job in a concurrency group at any time.
-concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
+# Workflow that runs python unit tests
+name: Run Python Unit Tests
 
+# The jobs in this workflow are required, so they must run at all times
+# * Always run on "main"
+# * Always run on PRs
 on:
   push:
     branches:
       - main
-    paths-ignore:
-      - '**/*.md'
-      - 'frontend/**'
-      - 'docs/**'
-      - 'evaluation/**'
   pull_request:
 
-
 jobs:
-  # Run frontend unit tests
-  fe-test:
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        node-version: [20]
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v4
-      - name: Set up Node.js
-        uses: actions/setup-node@v4
-        with:
-          node-version: ${{ matrix.node-version }}
-      - name: Install dependencies
-        working-directory: ./frontend
-        run: npm ci
-      - name: Run tests and collect coverage
-        working-directory: ./frontend
-        run: npm run test:coverage
-      - name: Upload coverage to Codecov
-        uses: codecov/codecov-action@v4
-        env:
-          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
-
   # Run python unit tests on macOS
   test-on-macos:
-    name: Test on macOS
+    name: Python Unit Tests on macOS
     runs-on: macos-12
     env:
       INSTALL_DOCKER: '1' # Set to '0' to skip Docker installation
@@ -123,7 +90,7 @@ jobs:
 
   # Run python unit tests on Linux
   test-on-linux:
-    name: Test on Linux
+    name: Python Unit Tests on Linux
     runs-on: ubuntu-latest
     env:
       INSTALL_DOCKER: '0' # Set to '0' to skip Docker installation