Skip to content

Commit

Permalink
fix: ci setup and run-parallel-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akurungadam committed Oct 20, 2024
1 parent 25f1ac3 commit c1035e1
Showing 1 changed file with 48 additions and 7 deletions.
55 changes: 48 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
# Run everday at midnight UTC / 5:30 IST
- cron: "0 0 * * *"
env:
FH_BRANCH: ${{ github.base_ref || github.ref_name }}
MARLEY_BRANCH: ${{ github.base_ref || github.ref_name }}

concurrency:
group: develop-${{ github.event.number }}
Expand All @@ -24,11 +24,17 @@ jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
NODE_ENV: "production"
WITH_COVERAGE: ${{ github.event_name != 'pull_request' }}

strategy:
fail-fast: false

name: Server
matrix:
container: [1]

name: Server Tests

services:
mysql:
Expand All @@ -40,7 +46,7 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Checkout Code Repository
- name: Clone
uses: actions/checkout@v4

- name: Set up Python
Expand All @@ -54,14 +60,22 @@ jobs:
node-version: 20
check-latest: true

- name: Check for valid Python & Merge Conflicts
run: |
python -m compileall -f "${GITHUB_WORKSPACE}"
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
then echo "Found merge conflicts"
exit 1
fi
- name: Add to Hosts
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
Expand Down Expand Up @@ -93,11 +107,38 @@ jobs:
- name: Install
run: |
bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
cd ~/frappe-bench/ && source env/bin/activate
env:
BRANCH_TO_CLONE: ${{ env.FH_BRANCH }}
FRAPPE_USER: ${{ github.event.inputs.user }}
FRAPPE_BRANCH: ${{ github.event.inputs.branch }}

- name: Run Tests
run: cd ~/frappe-bench/ && bench --site test_site run-tests --app healthcare
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app healthcare --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }}
env:
TYPE: server
CAPTURE_COVERAGE: ${{ github.event_name != 'pull_request' }}

- name: Upload coverage data
uses: actions/upload-artifact@v3
if: github.event_name != 'pull_request'
with:
name: coverage-${{ matrix.container }}
path: /home/runner/frappe-bench/sites/coverage.xml

coverage:
name: Coverage Wrap Up
needs: tests
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Clone
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3

- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

0 comments on commit c1035e1

Please sign in to comment.