-
Notifications
You must be signed in to change notification settings - Fork 5
63 lines (53 loc) · 2.35 KB
/
pytest.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
name: Pytest
on: [push, pull_request]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Pytest:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Setup python version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display python version
run: python -c "import sys; print(sys.version)"
# Install pip and packages
- name: Install pip
run: python -m pip install --upgrade pip
- name: Install packages
run: pip install pytest treelib
# Install clang and it's python inteface via apt
- name: Add llvm keys
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' | sudo tee -a /etc/apt/sources.list
echo 'deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' | sudo tee -a /etc/apt/sources.list
- name: Install libclang and its python bindings
run: |
sudo apt-get update
sudo apt-get install -y libclang-12-dev python3-clang-12
# Add dist-package to path to enable apt installed python3-clang import
- name: Add dist-packages to PYTHONPATH
run: echo "PYTHONPATH=${PYTHON_PATH}:/usr/lib/python3/dist-packages" >> $GITHUB_ENV
- name: Display PYTHONPATH
run: python -c "import sys; print('\n'.join(sys.path))"
# Test with pytest
- name: Test with pytest
run: pytest --junitxml=${GITHUB_WORKSPACE}/result_${{ matrix.python-version }}.xml
# Artifacts
- name: Upload pytest test results
uses: actions/upload-artifact@v2
with:
# We are in ${GITHUB_WORKSPACE}
# ${GITHUB_SHA} won't work: use ${{ github.sha }}
name: pytest_py${{ matrix.python-version }}-${{ github.sha }}
path: result_${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}