Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CrSjimo committed Oct 3, 2024
1 parent e9c94bc commit e514eaa
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 45 deletions.
59 changes: 20 additions & 39 deletions .github/actions/init-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,32 @@ runs:
archives: ${{ inputs.os == 'ubuntu-latest' && 'icu qtbase' || 'qtbase' }} qtsvg qtdeclarative qtremoteobjects qttools
cache: true

- name: Restore vcpkg from cache
- name: Prepare vcpkg
shell: pwsh
run: |
Write-Output VCPKG_REPO_REF=$((Get-Content scripts/vcpkg-manifest/vcpkg.json | ConvertFrom-Json).'builtin-baseline') >> $env:GITHUB_ENV
Write-Output VCPKG_DEFAULT_BINARY_CACHE=${{ github.workspace }}/vcpkg_archives >> $env:GITHUB_ENV
Write-Output VCPKG_CACHE_HASH=${{ hashFiles('scripts/vcpkg-manifest/vcpkg.json', 'scripts/vcpkg/**') }} >> $env:GITHUB_ENV
- name: Restore vcpkg binary cache from cache
id: cache_vcpkg
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg
key: ${{ runner.os }}-vcpkg-${{ hashFiles('scripts/vcpkg-manifest/vcpkg.json', 'scripts/vcpkg/**') }}
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ runner.os }}-vcpkg-${{ env.VCPKG_REPO_REF }}-${{ env.VCPKG_CACHE_HASH }}
restore-keys: |
${{ runner.os }}-vcpkg-
${{ runner.os }}-vcpkg-${{ env.VCPKG_REPO_REF }}-
- name: Install vcpkg dependencies
if: steps.cache_vcpkg.outputs.cache-hit != 'true'
shell: pwsh
run: |
if (!(Test-Path vcpkg)) {
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
${{ inputs.os == 'windows-latest' && './bootstrap-vcpkg.bat' || 'sh ./bootstrap-vcpkg.sh' }}
} else {
cd vcpkg
git pull origin master
if (!(Test-Path $env:VCPKG_DEFAULT_BINARY_CACHE)) {
mkdir $env:VCPKG_DEFAULT_BINARY_CACHE
}
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
${{ inputs.os == 'windows-latest' && './bootstrap-vcpkg.bat' || 'sh ./bootstrap-vcpkg.sh' }}
git checkout $env:VCPKG_REPO_REF
$env:QT_DIR="$env:Qt5_DIR/lib/cmake/Qt5"
$env:Qt5_DIR=$env:QT_DIR
$env:VCPKG_KEEP_ENV_VARS="QT_DIR;Qt5_DIR"
Expand All @@ -91,46 +96,22 @@ runs:
--x-manifest-root=${{ github.workspace }}/scripts/setup/diffscope-bridge `
--x-install-root=./bridge_installed `
--triplet=${{ env.VCPKG_TRIPLET_STATIC }}
if (Test-Path -Path buildtrees) {
Remove-Item -Path buildtrees -Recurse -Force
}
if (Test-Path -Path downloads) {
Remove-Item -Path downloads -Recurse -Force
}
if (Test-Path -Path packages) {
Remove-Item -Path packages -Recurse -Force
}
- name: Save vcpkg to cache
if: steps.cache_vcpkg.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}

- name: Restore ASIO SDK from cache
id: cache_asiosdk
if: inputs.os == 'windows-latest'
uses: actions/cache/restore@v4
with:
path: ${{github.workspace}}/asiosdk
key: asiosdk
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ runner.os }}-vcpkg-${{ env.VCPKG_REPO_REF }}-${{ env.VCPKG_CACHE_HASH }}

- name: Get ASIO SDK
if: inputs.os == 'windows-latest' && steps.cache_asiosdk.outputs.cache-hit != 'true'
if: inputs.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/CrSjimo/diffscope-ci-tools-mirror/refs/heads/main/asiosdk_2.3.3_2019-06-14.zip" -OutFile $env:RUNNER_TEMP/asiosdk.zip
Expand-Archive -Path $env:RUNNER_TEMP/asiosdk.zip -DestinationPath $env:GITHUB_WORKSPACE
Rename-Item -Path asiosdk_2.3.3_2019-06-14 -NewName asiosdk
- name: Save ASIO SDK to cache
if: inputs.os == 'windows-latest' && steps.cache_asiosdk.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{github.workspace}}/asiosdk
key: asiosdk

- name: Set directory variables
shell: pwsh
run: |
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/generate-bundles-and-release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
name: Generate Bundles and Release
on:
push:
branches:
- main
tags:
- "v*"
schedule:
- cron: '0 4 * * 1'
- 'v*'
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- 'README.md'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -169,7 +178,7 @@ jobs:
Release:
runs-on: ubuntu-latest
needs: Build
if: github.event_name == 'push'
if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name , 'v')
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
Expand Down
5 changes: 3 additions & 2 deletions scripts/vcpkg-manifest/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
"default-features": false
},
"interval-tree",
"boost-interprocess"
"boost-interprocess",
"wavpack"
],
"builtin-baseline": "5fa0f075ea51f305b627ecd5e050a363707353ff",
"builtin-baseline": "dd6fbdd22cc56af2ec8f97b4f62ce5ef612a891b",
"overrides": [
{
"name": "sdl2",
Expand Down

0 comments on commit e514eaa

Please sign in to comment.