Skip to content

Commit 163c3b1

Browse files
committed
Update CI workflow
1 parent 283acb4 commit 163c3b1

3 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Initialize dspm
2+
description: Initialize dspm
3+
4+
inputs:
5+
ref:
6+
description: "The ref to checkout"
7+
required: false
8+
default: "main"
9+
build-dir:
10+
description: "The directory to build in"
11+
required: false
12+
default: ${{ runner.workspace }}/diffscope-package-manager
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Restore dspm executable cache
18+
id: cache_dspm
19+
uses: actions/cache/restore@v4
20+
with:
21+
path: ${{inputs.build-dir}}/dist
22+
key: ${{ runner.os }}-dspm-${{ inputs.ref }}-${{ github.sha }}
23+
restore-keys: |
24+
${{ runner.os }}-dspm-${{ inputs.ref }}-
25+
26+
- name: Checkout
27+
if: steps.cache_dspm.outputs.cache-hit != 'true'
28+
shell: pwsh
29+
run: |
30+
git clone https://github.com/diffscope/diffscope-package-manager.git ${{inputs.build-dir}}
31+
cd ${{inputs.build-dir}}
32+
git checkout ${{ inputs.ref }}
33+
34+
- name: Setup Go
35+
uses: actions/setup-go@v6
36+
if: steps.cache_dspm.outputs.cache-hit != 'true'
37+
with:
38+
go-version-file: ${{inputs.build-dir}}/go.mod
39+
cache-dependency-path: ${{inputs.build-dir}}/go.sum
40+
41+
- name: Download dependencies
42+
if: steps.cache_dspm.outputs.cache-hit != 'true'
43+
working-directory: ${{ inputs.build-dir }}
44+
shell: pwsh
45+
run: go mod download
46+
47+
- name: Build
48+
if: steps.cache_dspm.outputs.cache-hit != 'true'
49+
working-directory: ${{ inputs.build-dir }}
50+
shell: pwsh
51+
run: |
52+
New-Item -ItemType Directory -Force dist | Out-Null
53+
$ext = if ($env:RUNNER_OS -eq 'Windows') { '.exe' } else { '' }
54+
go build -v -o "dist/dspm$ext" ./cmd/dspm
55+
56+
- name: Cache dspm executable
57+
uses: actions/cache/save@v4
58+
with:
59+
path: ${{inputs.build-dir}}/dist
60+
key: ${{ runner.os }}-dspm-${{ inputs.ref }}-${{ github.sha }}
61+
62+
- name: Output dspm path
63+
working-directory: ${{ inputs.build-dir }}
64+
shell: pwsh
65+
run: |
66+
$ext = if ($env:RUNNER_OS -eq 'Windows') { '.exe' } else { '' }
67+
Write-Output DSPM_EXECUTABLE_PATH=$(Resolve-Path dist/dspm$ext) >> $env:GITHUB_ENV

.github/workflows/dev-build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
INSTALL_DIR: ${{ github.workspace }}/build/install
5252
CCACHE_DIR: ${{ github.workspace }}/build/ccache
5353
MACOSX_DEPLOYMENT_TARGET: 13.0
54+
DSPM_REF: 51b75ae77caef5227be14da9e8e00a0593fbd83a
5455

5556
runs-on: ${{ matrix.os }}
5657

@@ -65,6 +66,11 @@ jobs:
6566
with:
6667
qt_version: ${{ env.QT_VERSION }}
6768

69+
- name: Initialize dspm
70+
uses: ./.github/actions/initialize-dspm
71+
with:
72+
ref: ${{ env.DSPM_REF }}
73+
6874
- name: Initialize Vcpkg
6975
uses: ./.github/actions/initialize-vcpkg
7076
with:
@@ -87,6 +93,7 @@ jobs:
8793
-BuildDir $env:BUILD_DIR `
8894
-InstallDir $env:INSTALL_DIR `
8995
-VersionIdentifier $env:VERSION_IDENTIFIER `
96+
-dspmExecutablePath $env:DSPM_EXECUTABLE_PATH `
9097
${{ github.event.inputs.use_ccache == 'true' && '-CCache' || '' }}
9198
Write-Output ARTIFACT_NAME=$($output.ApplicationName)_$($output.Semver -replace '[\.\-\+]', '_')_${{ runner.os }}_${{ runner.arch }} >> $env:GITHUB_ENV
9299
Write-Output APPLICATION_SEMVER=$($output.Semver) >> $env:GITHUB_ENV

scripts/ci/Build.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ param(
1515
[ValidateNotNullOrEmpty()]
1616
[string]$InstallDir,
1717

18+
[Parameter(Mandatory = $true)]
19+
[ValidateNotNullOrEmpty()]
20+
[string]$dspmExecutablePath,
21+
1822
[string]$VersionIdentifier = "0",
1923

2024
[switch]$CCache = $false
@@ -97,6 +101,7 @@ cmake -S . -B $(Resolve-Path $BuildDir) -G Ninja `
97101
"-DAPPLICATION_NAME=$applicationName" `
98102
"-DAPPLICATION_DISPLAY_NAME=$applicationDisplayName" `
99103
"-DAPPLICATION_SEMVER=$semver" `
104+
"-DDIFFSCOPE_PACKAGE_MANAGER_COMMAND_LINE_TOOL=$dspmExecutablePath" `
100105
"-DCMAKE_INSTALL_PREFIX=$(Resolve-Path $InstallDir)" | Write-Host
101106
if ($LASTEXITCODE -ne 0) {
102107
throw "Configure failed"

0 commit comments

Comments
 (0)