Rework search Page Resources: Filter based on values from shape 3 #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI pipeline | |
on: | |
pull_request: | |
branches: | |
- "**" # Runs on all pull requests | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 20.x ] # Define Node.js version (update as needed) | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js with the required version | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: npm install | |
# Step 4: Run Jest tests | |
- name: Run Jest tests | |
run: npm test -- --coverage | |
env: | |
CI: true # Ensures Jest runs in CI mode | |
# Step 5: Upload test coverage results (optional, if you want to store it in the workflow run artifacts) | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coverage # Assuming Jest saves coverage in the "coverage" directory | |
# Step 6: Fail the job if the test coverage is below a threshold (optional) | |
- name: Check coverage threshold | |
run: | | |
COVERAGE=$(grep -o '"total": {[^}]*}' coverage/coverage-summary.json | grep -o '"lines": {[^}]*}' | grep -o '"pct": [0-9]*' | grep -o '[0-9]*') | |
if [ "$COVERAGE" -lt 80 ]; then | |
echo "Test coverage below 80%. Coverage: $COVERAGE%" | |
exit 1 | |
fi |