Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Split Frontend and Python Unit tests (#3399)

mamoodi340fe0de18a4
diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml
index dddd97a4bb..70df755595 100644
--- a/.github/workflows/deploy-docs.yml
+++ b/.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:
diff --git a/.github/workflows/fe-unit-tests.yml b/.github/workflows/fe-unit-tests.yml
new file mode 100644
index 0000000000..eed8315c38
--- /dev/null
+++ b/.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 }}
diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/py-unit-tests.yml
similarity index 75%
rename from .github/workflows/run-unit-tests.yml
rename to .github/workflows/py-unit-tests.yml
index fb309c2749..acb005a057 100644
--- a/.github/workflows/run-unit-tests.yml
+++ b/.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