Skip to content

Commit

Permalink
CI: Rename workflow jobs and create a PowerShell script to cleanup Gi…
Browse files Browse the repository at this point in the history
…tHub Actions caches (#149)

* ci gh-actions: reorganize matrix with vcpkg tags

* script: GitHub repository cache clean

* ci gh-actions: use runner.temp again
  • Loading branch information
luncliff authored Dec 26, 2023
1 parent 917e78a commit c5af90f
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 28 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,55 @@ env:
VCPKG_FEATURE_FLAGS: "registries,binarycaching,manifests,versions"

jobs:
macos12:
manifest:
runs-on: "macos-12"
strategy:
fail-fast: false
matrix:
triplet: [x64-osx, arm64-ios]
include:
- vcpkg_tag: "2023.12.12"
vcpkg_commit: "c8696863d371ab7f46e213d8f5ca923c4aef2a00"
fail-fast: false
env:
VCPKG_DOWNLOADS: "/usr/local/share/vcpkg-downloads"
VCPKG_DEFAULT_BINARY_CACHE: "/usr/local/share/vcpkg-archives"
VCPKG_OVERLAY_PORTS: "${{ github.workspace }}/ports"
VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}/triplets
steps:
- uses: actions/[email protected]
- uses: ConorMacBride/[email protected]
with:
brew: ninja autoconf automake libtool

- name: "create cache folders"
run: |
mkdir -p ${VCPKG_DOWNLOADS}
mkdir -p ${VCPKG_DEFAULT_BINARY_CACHE}
- uses: actions/[email protected]
with:
key: "v2351-${{ runner.os }}-${{ matrix.triplet }}"
key: "v2351-${{ runner.os }}-${{ matrix.vcpkg_tag }}"
path: |
/usr/local/share/vcpkg-downloads
/usr/local/share/vcpkg-archives
- uses: ConorMacBride/[email protected]
- uses: lukka/[email protected]
with:
brew: ninja autoconf automake libtool
vcpkgDirectory: "/usr/local/share/vcpkg" # see VCPKG_INSTALLATION_ROOT
vcpkgGitCommitId: "${{ matrix.vcpkg_commit }}"
vcpkgJsonGlob: "test/vcpkg.json"
runVcpkgInstall: true
runVcpkgFormatString: '[`install`, `--clean-buildtrees-after-build`, `--clean-packages-after-build`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`]'
env:
VCPKG_DEFAULT_TRIPLET: "x64-osx"
VCPKG_BINARY_SOURCES: "default"

- uses: lukka/[email protected]
with:
vcpkgDirectory: "/usr/local/share/vcpkg" # see VCPKG_INSTALLATION_ROOT
vcpkgGitCommitId: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6" # 2023.11.20
vcpkgGitCommitId: "${{ matrix.vcpkg_commit }}"
vcpkgJsonGlob: "test/vcpkg.json"
runVcpkgInstall: true
runVcpkgFormatString: '[`install`, `--clean-buildtrees-after-build`, `--clean-packages-after-build`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`]'
env:
VCPKG_DEFAULT_TRIPLET: "${{ matrix.triplet }}"
VCPKG_DEFAULT_TRIPLET: "arm64-osx"
VCPKG_BINARY_SOURCES: "default"
26 changes: 17 additions & 9 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,51 @@ env:
VCPKG_FEATURE_FLAGS: "registries,binarycaching,manifests,versions"

jobs:
ubuntu22:
manifest:
# check https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
triplet: [x64-linux]
include:
# - vcpkg_tag: "2023.11.20"
# vcpkg_commit: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6"
- vcpkg_tag: "2023.12.12"
vcpkg_commit: "c8696863d371ab7f46e213d8f5ca923c4aef2a00"
fail-fast: false
env:
VCPKG_OVERLAY_PORTS: "${{ github.workspace }}/ports"
VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}/triplets
steps:
- uses: actions/[email protected]
- uses: ConorMacBride/[email protected]
with:
apt: nuget nasm libnuma-dev libopenmpi-dev libx11-dev libxi-dev libxext-dev libx11-xcb-dev

- name: "create cache folders"
run: |
mkdir -p ${VCPKG_DOWNLOADS}
mkdir -p ${VCPKG_DEFAULT_BINARY_CACHE}
env:
VCPKG_DOWNLOADS: "${{ runner.temp }}/vcpkg-downloads"
VCPKG_DEFAULT_BINARY_CACHE: "${{ runner.temp }}/vcpkg-archives"

- uses: actions/[email protected]
with:
key: "v2351-${{ runner.os }}-${{ matrix.triplet }}"
key: "v2351-x64-linux-${{ matrix.vcpkg_tag }}"
path: |
${{ runner.temp }}/vcpkg-downloads
${{ runner.temp }}/vcpkg-archives
- uses: ConorMacBride/[email protected]
with:
apt: nuget nasm libnuma-dev libopenmpi-dev libx11-dev libxi-dev libxext-dev libx11-xcb-dev
- uses: lukka/[email protected]
with:
vcpkgDirectory: "/usr/local/share/vcpkg" # see VCPKG_INSTALLATION_ROOT
doNotUpdateVcpkg: true
vcpkgGitCommitId: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6" # 2023.11.20
vcpkgGitCommitId: "${{ matrix.vcpkg_commit }}"
vcpkgJsonGlob: "test/vcpkg.json"
runVcpkgInstall: true
runVcpkgFormatString: '[`install`, `--clean-buildtrees-after-build`, `--clean-packages-after-build`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`]'
env:
VCPKG_DEFAULT_TRIPLET: "${{ matrix.triplet }}"
VCPKG_DEFAULT_TRIPLET: "x64-linux"
VCPKG_BINARY_SOURCES: "default"
VCPKG_DOWNLOADS: "${{ runner.temp }}/vcpkg-downloads"
VCPKG_DEFAULT_BINARY_CACHE: "${{ runner.temp }}/vcpkg-archives"
35 changes: 24 additions & 11 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,51 @@ env:
VCPKG_FEATURE_FLAGS: "registries,binarycaching,manifests,versions"

jobs:
windows2022:
manifest:
runs-on: "windows-2022"
strategy:
matrix:
triplet: [x64-windows]
include:
# - vcpkg_tag: "2023.10.19"
# vcpkg_commit: "8eb57355a4ffb410a2e94c07b4dca2dffbee8e50"
# - vcpkg_tag: "2023.11.20"
# vcpkg_commit: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6"
- vcpkg_tag: "2023.12.12"
vcpkg_commit: "c8696863d371ab7f46e213d8f5ca923c4aef2a00"
fail-fast: false
env:
VCPKG_DOWNLOADS: "C:/vcpkg/downloads"
VCPKG_DEFAULT_BINARY_CACHE: "C:/vcpkg/archives"
VCPKG_OVERLAY_PORTS: "${{ github.workspace }}/ports"
VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/triplets"
steps:
- uses: actions/[email protected]
- uses: microsoft/[email protected]
with:
msbuild-architecture: x64

- name: "create cache folders"
run: |
New-Item -Type Directory -Force ${env:VCPKG_DOWNLOADS}
New-Item -Type Directory -Force ${env:VCPKG_DEFAULT_BINARY_CACHE}
- uses: actions/[email protected]
with:
key: "v2351-${{ runner.os }}-${{ matrix.triplet }}"
key: "v2351-x64-windows-${{ matrix.vcpkg_tag }}"
path: |
C:/vcpkg/downloads
C:/vcpkg/archives
- uses: microsoft/[email protected]
with:
msbuild-architecture: x64
- uses: lukka/[email protected]
with:
vcpkgDirectory: "C:/vcpkg"
vcpkgGitCommitId: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6" # 2023.11.20
vcpkgGitCommitId: "${{ matrix.vcpkg_commit }}"
vcpkgJsonGlob: "test/vcpkg.json"
runVcpkgInstall: true
runVcpkgFormatString: '[`install`, `--clean-buildtrees-after-build`, `--clean-packages-after-build`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`]'
env:
VCPKG_DEFAULT_TRIPLET: "${{ matrix.triplet }}"
VCPKG_DEFAULT_TRIPLET: "x64-windows"
VCPKG_BINARY_SOURCES: "default"

cuda_x64:
runs-on: ["self-hosted", "Windows", "CUDA"]
Expand All @@ -52,14 +63,16 @@ jobs:
VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/triplets"
steps:
- uses: actions/[email protected]
- uses: microsoft/[email protected]
with:
msbuild-architecture: x64

- name: "create cache folders"
run: |
New-Item -Type Directory -Force ${env:VCPKG_DOWNLOADS}
New-Item -Type Directory -Force ${env:VCPKG_DEFAULT_BINARY_CACHE}
Move-Item -Path "test/self-hosted-cuda.json" -Destination "test/vcpkg.json" -Force
- uses: microsoft/[email protected]
with:
msbuild-architecture: x64
- uses: lukka/[email protected]
with:
vcpkgDirectory: "C:/vcpkg"
Expand Down
18 changes: 18 additions & 0 deletions scripts/gh-cache-cleanup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
param
(
[String]$Repository = "luncliff/vcpkg-registry",
[String]$Branch = "main",
[UInt16]$Count = 100,
[string]$CacheFile = "caches.txt"
)
# gh auth login
# gh extension install actions/gh-actions-cache
gh actions-cache list -R $Repository -B $Branch --limit $Count > $CacheFile

Get-Content $CacheFile | ForEach-Object {
$Fields = $_ -split ',|\t'
$Key = $Fields[0]
gh actions-cache delete $Key -R $Repository --confirm
}

Remove-Item $CacheFile

0 comments on commit c5af90f

Please sign in to comment.