Changeset - r28360:bb1633c75235
[Not reviewed]
master
0 4 0
Patric Stout - 4 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
 
@@ -108,6 +108,14 @@ jobs:
 
    - 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"
 
@@ -192,18 +200,13 @@ jobs:
 
    - 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: |
 
@@ -272,22 +275,13 @@ jobs:
 
    - 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
.github/workflows/release-linux.yml
Show inline comments
 
@@ -17,11 +17,6 @@ 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
 
@@ -57,18 +52,13 @@ 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
 
    - 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: |
 
@@ -132,7 +122,16 @@ jobs:
 
        # 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
 

	
.github/workflows/release-macos.yml
Show inline comments
 
@@ -32,6 +32,14 @@ jobs:
 
    - 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
 
@@ -47,20 +55,6 @@ jobs:
 
        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 \
.github/workflows/release-windows.yml
Show inline comments
 
@@ -45,6 +45,14 @@ jobs:
 
    - 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: |
 
@@ -56,23 +64,6 @@ jobs:
 
        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: |
0 comments (0 inline, 0 general)