aboutsummaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/tests.yml
blob: e39ce058abf350b5d9c0deb614b387743630817b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Tests
on:
  push:
  workflow_dispatch:
env:
  DEBIAN_FRONTEND: noninteractive

jobs:
  test:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        python-version: ["3.10", "3.11", "3.12"]
      fail-fast: false
    env:
      PYTHON: ${{ matrix.python-version }}
      SECCERTS_NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
    steps:
      - name: apt-get update
        run: sudo apt-get update
      - name: Install Poppler
        run: sudo apt-get install -y build-essential libpoppler-cpp-dev pkg-config python3-dev
      - uses: actions/checkout@v4
      - name: Install uv and Python
        uses: astral-sh/setup-uv@v7
        with:
          python-version: ${{ matrix.python-version }}
          enable-cache: true
      - name: Install sec-certs
        run: |
          uv sync --locked --dev
          uv run spacy download en_core_web_sm
      - name: Run tests
        run: uv run pytest --cov=sec_certs -m "not remote" --cov-report=xml --cov-report=term --junitxml=junit.xml -o junit_family=legacy tests
      - name: Test summary
        if: always()
        uses: test-summary/action@v2
        with:
          paths: junit.xml
          show: "fail, skip"
      - name: Code coverage upload
        if: ${{ matrix.python-version == 3.10 }}
        uses: codecov/codecov-action@v4
        with:
          env_vars: PYTHON
          token: ${{ secrets.CODECOV_TOKEN }}
      - name: Upload test results to Codecov
        if: ${{ !cancelled() &&  matrix.python-version == 3.10 }}
        uses: codecov/test-results-action@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}