From ed5aa3c15016d00ccb1a6a78afbf485bedc4fcbd Mon Sep 17 00:00:00 2001 From: glx22 Date: Wed, 29 Nov 2023 17:39:39 +0100 Subject: [PATCH] Codechange: [CI] Use runner vcpkg in release-linux workflow --- .github/workflows/release-linux.yml | 65 +++++++++++++---------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 29eea834e9066..0044ea14ad345 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -17,6 +17,11 @@ jobs: # manylinux2014 is based on CentOS 7, but already has a lot of things # installed and preconfigured. It makes it easier to build OpenTTD. image: quay.io/pypa/manylinux2014_x86_64 + volumes: + - /usr/local/share/vcpkg:/vcpkg + env: + ImageOS: ${{ env.ImageOS }} + ImageVersion: ${{ env.ImageVersion }} steps: - name: Download source @@ -41,13 +46,18 @@ jobs: - name: Enable Rust cache uses: Swatinem/rust-cache@v2 + - name: Prepare cache key + id: key + run: | + echo "image=$ImageOS-$ImageVersion" >> $GITHUB_OUTPUT + - name: Enable vcpkg cache uses: actions/cache@v3 with: path: /vcpkg/installed - key: ubuntu-20.04-vcpkg-release-1 # Increase the number whenever dependencies are modified + key: ${{ steps.key.outputs.image }}-vcpkg-release-1 # Increase the number whenever dependencies are modified restore-keys: | - ubuntu-20.04-vcpkg-release + ${{ steps.key.outputs.image }}-vcpkg-release - name: Install dependencies run: | @@ -103,40 +113,23 @@ jobs: # We use vcpkg for our dependencies, to get more up-to-date version. echo "::group::Install vcpkg and dependencies" - # We do a little dance to make sure we copy the cached install folder - # into our new clone. - git clone --depth=1 https://github.com/microsoft/vcpkg /vcpkg-clone - if [ -e /vcpkg/installed ]; then - mv /vcpkg/installed /vcpkg-clone/ - rm -rf /vcpkg - fi - mv /vcpkg-clone /vcpkg - - ( - cd /vcpkg - ./bootstrap-vcpkg.sh -disableMetrics - - # Once installed (and cached) a package will never be upgraded unless we do it ourselves. - ./vcpkg upgrade --no-dry-run - - # Make Python3 available for other packages. - ./vcpkg install python3 - ln -sf $(pwd)/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3 - - ./vcpkg install \ - breakpad \ - curl[http2] \ - fontconfig \ - freetype \ - harfbuzz \ - icu \ - liblzma \ - libpng \ - lzo \ - sdl2 \ - zlib \ - # EOF - ) + # Make Python3 available for other packages. + /vcpkg/vcpkg install python3 + ln -sf /vcpkg/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3 + + /vcpkg/vcpkg install \ + breakpad \ + curl[http2] \ + fontconfig \ + freetype \ + harfbuzz \ + icu \ + liblzma \ + libpng \ + lzo \ + sdl2 \ + zlib \ + # EOF echo "::endgroup::" echo "::group::Install breakpad dependencies"