Update wheels.yml #307
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build package on different Os and Python versions | |
on : [push, pull_request] | |
jobs: | |
build_package: | |
name: Build ${{ github.event.repository.name }} on ${{ matrix.os }} for Python-${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: [3.8, 3.9, '3.10', '3.11'] | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
# ccache requires absolute path | |
path_ccache: /home/runner/cache/ccache | |
- os: macos-latest | |
path: ~/Library/Caches/pip | |
# ccache requires absolute path | |
path_ccache: /Users/runner/Library/Caches/ccache | |
- os: windows-latest | |
path: ~\AppData\Local\pip\Cache | |
# FIXME: ccache is currently not available on Windows | |
# path_ccache: ~\AppData\Local\ccache\Cache | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
name: Install Python-${{ matrix.python-version }} | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Activating Python cache | |
uses: actions/cache@v2 | |
id: cache_python | |
continue-on-error: true | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |
# FIXME: This is quite costly but at the moment I don't have an alternative | |
- name: Install ccache for Linux and Mac | |
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt -y install ccache | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
brew install ccache | |
fi | |
shell: bash | |
# Windows does not support ccache with visual studio compiler | |
- name: ccache cache files | |
if: ${{ runner.os != 'Windows' }} | |
uses: actions/cache@v2 | |
id: cache_ccache | |
continue-on-error: true | |
with: | |
path: ${{ matrix.path_ccache }} | |
# TODO: When updating c++ backend, use new date (yy-mm-dd) | |
key: ${{ runner.os }}-ccache-${{ matrix.python-version }}-21-11-08 | |
- name: Upgrade pip and setuptools | |
run: | | |
python -m pip install --upgrade pip setuptools | |
- name: Build giotto-ph on Linux and MacOs | |
if: ${{ runner.os != 'Windows' }} | |
run: | | |
# Print cache status before and after | |
ccache -s | |
python -m pip install -e . | |
ccache -s | |
env: | |
CC: "ccache gcc" | |
CXX: "ccache g++" | |
CCACHE_DIR: ${{ matrix.path_ccache }} | |
CCACHE_COMPRESS: 1 | |
CCACHE_MAXSIZE: 4G | |
# Windows does not support ccache with visual studio compiler | |
- name: Build giotto-ph on Windows | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
python -m pip install -e . | |
- name: Run test | |
run: | | |
python -m pip install pytest hypothesis | |
python -m pytest |