From 1ff78a3a05f1686046a8a2a16ba588382d8f4a14 Mon Sep 17 00:00:00 2001 From: Cuong Duong Date: Sun, 3 Oct 2021 18:41:19 +1100 Subject: [PATCH] Speed up Linux wheel building and other fixes (#2040) --- .github/workflows/build-and-test.yml | 10 ++++++++-- .github/workflows/wheel.yml | 17 ++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f881d04..12bebc3 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -19,6 +19,12 @@ jobs: fail-fast: false steps: + - name: "Get OS version (Linux)" + if: startsWith(runner.os, 'Linux') + run: | + echo "OS_VERSION=`lsb_release -sr`" >> $GITHUB_ENV + echo "PIP_DEFAULT_CACHE=$HOME/.cache/pip" >> $GITHUB_ENV + echo "DEFAULT_HOME=$HOME" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 @@ -28,7 +34,7 @@ jobs: id: cache-pip uses: actions/cache@v2 with: - path: $HOME/.cache/pip + path: ${{ env.PIP_DEFAULT_CACHE }} key: ${{ runner.os }}-pip-${{ hashFiles('**/python/requirements.txt') }}-v1 restore-keys: | ${{ runner.os }}-pip- @@ -36,7 +42,7 @@ jobs: id: cache-cmdstan uses: actions/cache@v2 with: - path: $HOME/.cmdstan + path: ${{ env.DEFAULT_HOME }}/.cmdstan key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}-v1 - name: "Download cmdstan" if: steps.cache-cmdstan.outputs.cache-hit != 'true' diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 1f3ccb7..a241486 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -15,15 +15,9 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: - - "macos-latest" - - "ubuntu-latest" - python-version: - - "3.6" - - "3.7" - - "3.8" - architecture: - - x64 + os: ["macos-latest", "ubuntu-latest"] + python-version: [3.8] + architecture: ["x64"] fail-fast: false @@ -87,13 +81,14 @@ jobs: STAN_BACKEND="${{ env.STAN_BACKEND }}" CMDSTAN_VERSION=${{ env.CMDSTAN_VERSION }} # Linux builds run in a Docker container, need to point the cache to the host machine. - CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_ENVIRONMENT_LINUX: > STAN_BACKEND="${{ env.STAN_BACKEND }}" CMDSTAN_VERSION=${{ env.CMDSTAN_VERSION }} HOME="/host/${{ env.DEFAULT_HOME }}" PIP_CACHE_DIR="/host/${{ env.PIP_DEFAULT_CACHE }}" - CIBW_BEFORE_ALL_LINUX: sudo chmod -R a+rwx ${{ env.PIP_DEFAULT_CACHE }} + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_BEFORE_ALL_LINUX: chmod -R a+rwx /host/${{ env.PIP_DEFAULT_CACHE }} + CIBW_BUILD: cp36-* cp37-* cp38-* CIBW_ARCHS: native CIBW_BUILD_FRONTEND: build CIBW_TEST_REQUIRES: pytest