Changeset - r28360:bb1633c75235
[Not reviewed]
master
0 4 0
Patric Stout - 11 months ago 2023-12-30 16:58:18
truebrain@openttd.org
Change: [CI] use vcpkg built-in caching mechanism
4 files changed with 52 insertions and 74 deletions:
0 comments (0 inline, 0 general)
.github/workflows/ci-build.yml
Show inline comments
 
@@ -105,12 +105,20 @@ jobs:
 
      CXX: ${{ matrix.cxxcompiler }}
 

	
 
    steps:
 
    - name: Checkout
 
      uses: actions/checkout@v3
 

	
 
    - name: Setup vcpkg caching
 
      uses: actions/github-script@v6
 
      with:
 
        script: |
 
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Install dependencies
 
      run: |
 
        echo "::group::Update apt"
 
        sudo apt-get update
 
        echo "::endgroup::"
 

	
 
@@ -189,24 +197,19 @@ jobs:
 
      MACOSX_DEPLOYMENT_TARGET: 10.13
 

	
 
    steps:
 
    - name: Checkout
 
      uses: actions/checkout@v3
 

	
 
    - name: Prepare cache key
 
      id: key
 
      run: |
 
        echo "image=$ImageOS-$ImageVersion" >> $GITHUB_OUTPUT
 

	
 
    - name: Enable vcpkg cache
 
      uses: actions/cache@v3
 
    - name: Setup vcpkg caching
 
      uses: actions/github-script@v6
 
      with:
 
        path: /usr/local/share/vcpkg/installed
 
        key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-1 # Increase the number whenever dependencies are modified
 
        restore-keys: |
 
          ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
 
        script: |
 
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Prepare vcpkg
 
      run: |
 
        vcpkg install --triplet=${{ matrix.arch }}-osx \
 
          breakpad \
 
          curl \
 
@@ -269,28 +272,19 @@ jobs:
 
    runs-on: ${{ matrix.os }}
 

	
 
    steps:
 
    - name: Checkout
 
      uses: actions/checkout@v3
 

	
 
    - name: Prepare cache key
 
      id: key
 
      shell: powershell
 
      run: |
 
        # Work around caching failure with GNU tar
 
        New-Item -Type Junction -Path vcpkg -Target c:\vcpkg
 

	
 
        Write-Output "image=$env:ImageOS-$env:ImageVersion" >> $env:GITHUB_OUTPUT
 

	
 
    - name: Enable vcpkg cache
 
      uses: actions/cache@v3
 
    - name: Setup vcpkg caching
 
      uses: actions/github-script@v6
 
      with:
 
        path: vcpkg/installed
 
        key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-1 # Increase the number whenever dependencies are modified
 
        restore-keys: |
 
          ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
 
        script: |
 
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Prepare vcpkg
 
      shell: bash
 
      run: |
 
        vcpkg install --triplet=${{ matrix.arch }}-windows-static \
 
          breakpad \
.github/workflows/release-linux.yml
Show inline comments
 
@@ -14,17 +14,12 @@ jobs:
 

	
 
    runs-on: ubuntu-latest
 
    container:
 
      # 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
 
      uses: actions/download-artifact@v3
 
      with:
 
        name: internal-source
 
@@ -54,24 +49,19 @@ jobs:
 
    - name: Install Rust toolchain
 
      uses: dtolnay/rust-toolchain@stable
 

	
 
    - 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
 
    - name: Setup vcpkg caching
 
      uses: actions/github-script@v6
 
      with:
 
        path: /vcpkg/installed
 
        key: ${{ steps.key.outputs.image }}-vcpkg-release-1 # Increase the number whenever dependencies are modified
 
        restore-keys: |
 
          ${{ steps.key.outputs.image }}-vcpkg-release
 
        script: |
 
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Install dependencies
 
      run: |
 
        echo "::group::Install system dependencies"
 
        # perl-IPC-Cmd, wget, and zip are needed to run vcpkg.
 
        # autoconf-archive is needed to build ICU.
 
@@ -129,13 +119,22 @@ jobs:
 
          # EOF
 
        echo "::endgroup::"
 

	
 
        # We use vcpkg for our dependencies, to get more up-to-date version.
 
        echo "::group::Install vcpkg and dependencies"
 

	
 
        # Make Python3 available for other packages.
 
        git clone https://github.com/microsoft/vcpkg /vcpkg
 

	
 
        (
 
          cd /vcpkg
 
          ./bootstrap-vcpkg.sh -disableMetrics
 
        )
 

	
 
        # Make Python3 available for other packages. This needs to be done
 
        # first, as otherwise dependencies fail to build because Python3 is
 
        # not available.
 
        /vcpkg/vcpkg install python3
 
        ln -sf /vcpkg/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3
 

	
 
        # SDL2 needs dbus, but dbus default install comes with libsystemd
 
        # and some of libsystemd deps fail to build on our quite old linux.
 
        # So just install basic dbus without any extra deps.
.github/workflows/release-macos.yml
Show inline comments
 
@@ -29,12 +29,20 @@ jobs:
 
    - name: Install Rust toolchain
 
      uses: dtolnay/rust-toolchain@stable
 

	
 
    - name: Enable Rust cache
 
      uses: Swatinem/rust-cache@v2
 

	
 
    - name: Setup vcpkg caching
 
      uses: actions/github-script@v6
 
      with:
 
        script: |
 
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Install dependencies
 
      env:
 
        HOMEBREW_NO_AUTO_UPDATE: 1
 
        HOMEBREW_NO_INSTALL_CLEANUP: 1
 
      run: |
 
        echo "::group::Install brew dependencies"
 
@@ -44,26 +52,12 @@ jobs:
 
        echo "::endgroup::"
 

	
 
        echo "::group::Install breakpad dependencies"
 
        cargo install dump_syms
 
        echo "::endgroup::"
 

	
 
    - name: Prepare cache key
 
      id: key
 
      run: |
 
        echo "image=$ImageOS-$ImageVersion" >> $GITHUB_OUTPUT
 

	
 
    - name: Enable vcpkg cache
 
      uses: actions/cache@v3
 
      with:
 
        path: /usr/local/share/vcpkg/installed
 
        key: ${{ steps.key.outputs.image }}-vcpkg-release-1 # Increase the number whenever dependencies are modified
 
        restore-keys: |
 
          ${{ steps.key.outputs.image }}-vcpkg-release
 
          ${{ steps.key.outputs.image }}-vcpkg-x64
 

	
 
    - name: Prepare vcpkg
 
      run: |
 
        vcpkg install \
 
          breakpad:x64-osx \
 
          breakpad:arm64-osx \
 
          curl:x64-osx \
.github/workflows/release-windows.yml
Show inline comments
 
@@ -42,40 +42,31 @@ jobs:
 
    - name: Install Rust toolchain
 
      uses: dtolnay/rust-toolchain@stable
 

	
 
    - name: Enable Rust cache
 
      uses: Swatinem/rust-cache@v2
 

	
 
    - name: Setup vcpkg caching
 
      uses: actions/github-script@v6
 
      with:
 
        script: |
 
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Install dependencies
 
      shell: bash
 
      run: |
 
        echo "::group::Install choco dependencies"
 
        choco install pandoc
 
        echo "::endgroup::"
 

	
 
        echo "::group::Install breakpad dependencies"
 
        cargo install dump_syms
 
        echo "::endgroup::"
 

	
 
    - name: Prepare cache key
 
      id: key
 
      shell: powershell
 
      run: |
 
        # Work around caching failure with GNU tar
 
        New-Item -Type Junction -Path vcpkg -Target c:\vcpkg
 

	
 
        Write-Output "image=$env:ImageOS-$env:ImageVersion" >> $env:GITHUB_OUTPUT
 

	
 
    - name: Enable vcpkg cache
 
      uses: actions/cache@v3
 
      with:
 
        path: vcpkg/installed
 
        key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-1 # Increase the number whenever dependencies are modified
 
        restore-keys: |
 
          ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
 

	
 
    - name: Prepare vcpkg
 
      shell: bash
 
      run: |
 
        vcpkg install --triplet=${{ matrix.arch }}-windows-static \
 
          liblzma \
 
          libpng \
0 comments (0 inline, 0 general)