1name: Coverage
2
3on:
4  push:
5    branches:
6    - master
7    - 3.9
8    - 3.8
9    - 3.7
10    paths-ignore:
11    - 'Doc/**'
12    - 'Misc/**'
13  #pull_request:
14  #  branches:
15  #  - master
16  #  - 3.9
17  #  - 3.8
18  #  - 3.7
19  #  paths-ignore:
20  #  - 'Doc/**'
21  #  - 'Misc/**'
22
23jobs:
24  coverage_ubuntu:
25    name: 'Ubuntu (Coverage)'
26    runs-on: ubuntu-latest
27    env:
28      OPENSSL_VER: 1.1.1f
29    steps:
30    - uses: actions/checkout@v2
31    - name: Install Dependencies
32      run: sudo ./.github/workflows/posix-deps-apt.sh
33    - name: 'Restore OpenSSL build'
34      id: cache-openssl
35      uses: actions/cache@v2.1.3
36      with:
37        path: ./multissl/openssl/${{ env.OPENSSL_VER }}
38        key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
39    - name: Install OpenSSL
40      if: steps.cache-openssl.outputs.cache-hit != 'true'
41      run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
42    - name: Configure CPython
43      run: ./configure --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
44    - name: Build CPython
45      run: make -j4
46    - name: Display build info
47      run: make pythoninfo
48    - name: 'Coverage Preparation'
49      run: |
50        ./python -m venv .venv
51        source ./.venv/bin/activate
52        python -m pip install -U coverage
53        python -m pip install -r Misc/requirements-test.txt
54        python -m test.pythoninfo
55    - name: 'Tests with coverage'
56      run: >
57        source ./.venv/bin/activate &&
58        xvfb-run python -m coverage
59        run --branch --pylib
60        -m test
61        --fail-env-changed
62        -uall,-cpu
63        -x test_multiprocessing_fork
64        -x test_multiprocessing_forkserver
65        -x test_multiprocessing_spawn
66        -x test_concurrent_futures
67        || true
68    - name: 'Publish code coverage results'
69      run: |
70        source ./.venv/bin/activate
71        bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
72      env:
73        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
74
75  c_coverage_ubuntu:
76    name: 'Ubuntu (C Coverage)'
77    runs-on: ubuntu-latest
78    steps:
79    - uses: actions/checkout@v2
80    - name: Install Dependencies
81      run: sudo ./.github/workflows/posix-deps-apt.sh
82    - name: Configure CPython
83      run: ./configure
84    - name: 'Build CPython and measure coverage'
85      run: xvfb-run make -j4 coverage-report
86    - name: 'Publish code coverage results'
87      if: always()
88      run: |
89        make pythoninfo
90        bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
91      env:
92        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
93