aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: 06043a33f04b01f0eb2178ff9cd5f242757b421a (plain)
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
name: Test

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        CC: [gcc, clang]
    env:
      CC: ${{ matrix.CC }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - name: Setup ${{ matrix.CC }}
        run: |
          sudo apt-get update
          sudo apt-get install -y $CC dpkg apt
      - name: Setup pari
        run: |
          wget -q https://mirrors.edge.kernel.org/ubuntu/pool/universe/p/pari/libpari-gmp-tls8_2.15.2-1_amd64.deb
          wget -q https://mirrors.edge.kernel.org/ubuntu/pool/universe/p/pari/libpari-dev_2.15.2-1_amd64.deb
          wget -q https://mirrors.edge.kernel.org/ubuntu/pool/universe/p/pari/pari-gp_2.15.2-1_amd64.deb
          wget -q https://mirrors.edge.kernel.org/ubuntu/pool/main/r/readline/libreadline8_8.2-1_amd64.deb
          wget -q https://mirrors.edge.kernel.org/ubuntu/pool/main/n/ncurses/libtinfo6_6.4-4_amd64.deb
          wget -q https://pari.math.u-bordeaux.fr/pub/pari/packages/seadata.tgz
          sudo dpkg --force-all -i libtinfo6_6.4-4_amd64.deb libreadline8_8.2-1_amd64.deb libpari-gmp-tls8_2.15.2-1_amd64.deb libpari-dev_2.15.2-1_amd64.deb pari-gp_2.15.2-1_amd64.deb
          DATADIR=$(echo "default(datadir)" | gp -q | cut -d\" -f2)
          sudo tar --strip-components=1 -C ${DATADIR} -xzf seadata.tgz data/
      - name: Test
        run: |
          TEST=1 make unittest
      - name: Code coverage
        if: ${{ matrix.CC == 'gcc' }}
        run: |
          cd src && find . -name "*.gcda" -exec gcov -pb "{}" +;
      - name: Code coverage upload
        uses: codecov/codecov-action@v3
        if: ${{ matrix.CC == 'gcc' }}
        with:
          env_vars: CC
          gcov: true