cache mxe builds (#41472)

This commit is contained in:
Denis Rouzaud 2021-02-17 11:07:39 +01:00 committed by GitHub
parent 0c36f28295
commit 4fc02733cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 18 deletions

View File

@ -29,14 +29,58 @@ on:
jobs:
build:
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Dockerfile
run: |
cd ms-windows/mxe
docker build -f mxe.Dockerfile --tag mxe-qt5-builder:current .
- name: Prepare build cache for pull request
uses: pat-s/always-upload-cache@v2.1.3
if: github.event_name == 'pull_request'
with:
path: ${{ github.workspace }}/.ccache
key: mxe-ccache-${{ github.actor }}-${{ github.head_ref }}-${{ github.sha }}
# The head_ref or source branch of the pull request in a workflow run.
# The base_ref or target branch of the pull request in a workflow run.
restore-keys: |
mxe-ccache-${{ github.actor }}-${{ github.head_ref }}-
mxe-ccache-${{ github.base_ref }}-
mxe-ccache-refs/heads/master-
- name: Prepare build cache for branch/tag
# use a fork of actions/cache@v2 to upload cache even when the build or test failed
uses: pat-s/always-upload-cache@v2.1.3
if: github.event_name != 'pull_request'
with:
path: ${{ github.workspace }}/.ccache
# The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name>
key: mxe-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
mxe-ccache-${{ github.ref }}-
mxe-ccache-refs/heads/master-
- name: Cross build with MXE
run: cd $GITHUB_WORKSPACE && ms-windows/mxe/build.sh
run: |
mkdir -p ${{ github.workspace }}/.ccache
docker run -v ${GITHUB_WORKSPACE}:/root/QGIS \
-w /root/QGIS \
--env CCACHE_DIR=/root/QGIS/.ccache \
mxe-qt5-builder:current \
/root/QGIS/ms-windows/mxe/build-mxe.sh
- name: Rename artifact
run: cd $GITHUB_WORKSPACE && mv qgis-mxe-release-*.zip qgis-mxe-release.zip
run: |
cd $GITHUB_WORKSPACE
mv qgis-mxe-release-*.zip qgis-mxe-release.zip
- name: Upload build
uses: actions/upload-artifact@v2.2.2
with:

View File

@ -50,9 +50,6 @@ TARGET=x86_64-w64-mingw32.shared
# Set base path for all tools
export PATH=${PATH}:${MXE}/usr/bin
# Fix CCACHE directory
export CCACHE_DIR=${PWD}/.ccache
if [ ! -e ${CCACHE_DIR} ]; then
mkdir -p ${CCACHE_DIR}
fi
@ -73,9 +70,12 @@ cd ${BUILD_DIR}
if [[ "$COMMAND" != *"package"* ]]; then
echo "::group::compile QGIS"
${MXE}/usr/bin/${TARGET}-cmake .. \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DCMAKE_INSTALL_PREFIX=${RELEASE_DIR} \
-DUSE_CCACHE=ON \
-DENABLE_TESTS=OFF \
-DWITH_QSPATIALITE=ON \
-DWITH_APIDOC=OFF \
@ -90,8 +90,15 @@ if [[ "$COMMAND" != *"package"* ]]; then
make -j16 install
echo "::endgroup::"
#echo "ccache statistics"
ccache -s
fi
echo "::group::package"
# Collect deps
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/${TARGET}-objdump ${RELEASE_DIR}/qgis.exe
@ -108,7 +115,6 @@ __TXT__
# First cleanup
rm -rf ${BUILD_DIR}
rm -rf ${CCACHE_DIR}
# Make the zip
@ -119,6 +125,8 @@ zip -r -m ${ZIP_NAME} $(basename ${RELEASE_DIR})
# Second cleanup
rm -rf ${RELEASE_DIR}
echo "::endgroup::"
popd
echo "Release in $ZIP_NAME ready."

View File

@ -1,11 +0,0 @@
#!/bin/bash
# Location of current script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker run \
-v $(pwd):$(pwd) \
-w $(pwd) --rm \
--user $(id -u):$(id -g) \
elpaso/mxe-qt5-builder \
${DIR}/build-mxe.sh

View File

@ -10,7 +10,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
software-properties-common \
lsb-release \
gpg-agent \
python3-distutils
python3-distutils \
ccache
RUN apt-key adv \
--keyserver keyserver.ubuntu.com \