Skip to content

Commit

Permalink
[pytest.yml] use docker
Browse files Browse the repository at this point in the history
  • Loading branch information
diivm committed Aug 21, 2021
1 parent be6a5da commit 384b6fc
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,13 @@ jobs:
- 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))"
- name: Build docker
run: docker build --pull --rm -f "Dockerfile" -t clangbind:latest "."

# Test with pytest
- name: Test with pytest
run: pytest --junitxml=${GITHUB_WORKSPACE}/result_${{ matrix.python-version }}.xml
run: docker run --rm -t clangbind:latest -c "export PYTHONPATH=.; \
pytest --junitxml=${GITHUB_WORKSPACE}/result_${{ matrix.python-version }}.xml"

# Artifacts
- name: Upload pytest test results
Expand Down

0 comments on commit 384b6fc

Please sign in to comment.