|
1 | 1 | --- |
| 2 | +name: Minimal Tests |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: ["main"] |
| 8 | + pull_request: |
| 9 | + branches: ["main"] |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + FORCE_COLOR: "1" |
| 17 | + |
| 18 | +jobs: |
| 19 | + minimal_tests: |
2 | 20 | name: Minimal Tests |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + fail-fast: true |
| 24 | + matrix: |
| 25 | + python-version: ["3.10"] |
| 26 | + defaults: |
| 27 | + run: |
| 28 | + working-directory: backend |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + lfs: true |
| 33 | + |
| 34 | + - name: Setup Python |
| 35 | + uses: ./.github/actions/setup-python/ |
| 36 | + with: |
| 37 | + python-version: ${{ matrix.python-version }} |
3 | 38 |
|
4 | | - on: |
5 | | - workflow_dispatch: |
6 | | - push: |
7 | | - branches: ["main"] |
8 | | - pull_request: |
9 | | - branches: [ "main"] |
| 39 | + # pre-commit checks handled by pre-commit.ci |
10 | 40 |
|
11 | | - concurrency: |
12 | | - group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} |
13 | | - cancel-in-progress: true |
14 | | - env: |
15 | | - FORCE_COLOR: "1" |
16 | | - jobs: |
17 | | - minimal_tests: |
18 | | - name: Minimal Tests |
19 | | - runs-on: ubuntu-latest |
20 | | - strategy: |
21 | | - fail-fast: true |
22 | | - matrix: |
23 | | - python-version: ["3.11"] #,"3.9","3.10"] |
24 | | - steps: |
25 | | - #---------------------------------------------- |
26 | | - # check-out repo and set-up python |
27 | | - #---------------------------------------------- |
28 | | - - uses: actions/checkout@v4 |
29 | | - with: |
30 | | - lfs: true |
31 | | - - name: Setup Python |
32 | | - uses: ./.github/actions/setup-python/ |
33 | | - with: |
34 | | - python-version: ${{ matrix.python-version }} |
35 | | - - name: Cache pre-commit hooks |
36 | | - uses: actions/cache@v4 |
37 | | - if: github.ref != 'refs/heads/main' |
38 | | - with: |
39 | | - path: ~/.cache/pre-commit |
40 | | - key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} |
| 41 | + - name: Run tests |
| 42 | + env: |
| 43 | + DJANGO_SETTINGS_MODULE: backend.server.settings.dev |
| 44 | + run: | |
| 45 | + uv run coverage run --rcfile=pyproject.toml --source=. -m \ |
| 46 | + pytest -x -vv ../tests/unit \ |
| 47 | + --ignore=../tests/unit/test_logs.py \ |
| 48 | + --ignore=../tests/unit/test_visitran_adapters \ |
| 49 | + --ignore=../tests/unit/test_visitran_backend \ |
| 50 | + -m "not snowflake and not bigquery and not trino and not postgres" |
41 | 51 |
|
42 | | - - name: Check pre-commit |
43 | | - if: github.ref != 'refs/heads/main' |
44 | | - run: | |
45 | | - uv run pre-commit run --all-files |
46 | | - - name: Run minimal core tests |
47 | | - run: | |
48 | | - uv run coverage run --rcfile=pyproject.toml --data-file=minimal.cov --context="minimal" --source=. -m \ |
49 | | - pytest -x -vv -m "not snowflake and not bigquery and not trino and not postgres" |
50 | | - - name: Run backend tests |
51 | | - run: | |
52 | | - uv run coverage run --rcfile=pyproject.toml --data-file=backend.cov --context="backend" --source=. -m \ |
53 | | - pytest -x -vv ./visitran_backend |
| 52 | + - name: Generate coverage report |
| 53 | + run: | |
| 54 | + uv run coverage report -m |
| 55 | + uv run coverage xml |
54 | 56 |
|
55 | | - - name: Combine to coverage xml |
56 | | - run: | |
57 | | - uv run coverage combine backend.cov minimal.cov |
58 | | - uv run coverage report -m |
59 | | - uv run coverage xml |
60 | | - - name: Git fetch unshallow |
61 | | - run: | |
62 | | - git fetch --unshallow |
| 57 | + - name: Git fetch unshallow |
| 58 | + working-directory: . |
| 59 | + run: git fetch --unshallow |
63 | 60 |
|
64 | | - - name: Core SonarCloud Scan |
65 | | - uses: SonarSource/sonarcloud-github-action@master |
66 | | - if: ${{ github.actor != 'dependabot[bot]' }} |
67 | | - env: |
68 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
69 | | - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
70 | | - with: |
71 | | - projectBaseDir: ./ |
72 | | - args: > |
73 | | - -Dproject.settings=./sonar-project.properties |
| 61 | + - name: SonarCloud Scan |
| 62 | + uses: SonarSource/sonarcloud-github-action@v3 |
| 63 | + if: ${{ github.actor != 'dependabot[bot]' }} |
| 64 | + continue-on-error: true |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 68 | + with: |
| 69 | + projectBaseDir: ./ |
| 70 | + args: > |
| 71 | + -Dproject.settings=./sonar-project.properties |
0 commit comments