Files
SWCompression/azure-pipelines.yml
2026-06-13 16:22:24 +08:00

220 lines
7.3 KiB
YAML

trigger:
branches:
exclude:
- master
tags:
include:
- '*'
exclude:
- '*-test*'
stages:
- stage: cache
displayName: 'Cache Test Files'
jobs:
- job: cache
pool:
vmImage: 'macOS-26'
variables:
GIT_LFS_SKIP_SMUDGE: 1
steps:
- script: |
set -e -o xtrace
git submodule update --init --recursive
cp "Tests/Test Files/gitattributes-copy" "Tests/Test Files/.gitattributes"
displayName: 'Update submodules'
- script: |
set -e -o xtrace
cd "Tests/Test Files"
echo "##vso[task.setvariable variable=lfsRev;]$(git rev-parse --verify HEAD)"
displayName: 'Generate assets-id'
- task: Cache@2
inputs:
key: '"swc_test_files_v5_" | "$(lfsRev)"'
path: 'Tests/Test Files'
displayName: 'Cache test files'
- script: |
set -e -o xtrace
cd "Tests/Test Files"
git lfs fetch
git lfs checkout
displayName: 'Download test files'
- stage: test
displayName: 'Build & Test'
dependsOn: cache
jobs:
- job: macos
timeoutInMinutes: 90
strategy:
matrix:
macosSwift60:
imageName: 'macOS-15'
DEVELOPER_DIR: '/Applications/Xcode_16.2.app'
IOS_SIMULATOR: 'iPhone 16'
WATCHOS_SIMULATOR: 'Apple Watch Series 10 (42mm)'
macosSwift61:
imageName: 'macOS-15'
DEVELOPER_DIR: '/Applications/Xcode_16.4.app'
IOS_SIMULATOR: 'iPhone 16'
WATCHOS_SIMULATOR: 'Apple Watch Series 10 (42mm)'
macosSwift62:
imageName: 'macOS-15'
DEVELOPER_DIR: '/Applications/Xcode_26.3.app'
IOS_SIMULATOR: 'iPhone 17'
WATCHOS_SIMULATOR: 'Apple Watch Series 10 (42mm)'
macosSwift63:
imageName: 'macOS-26'
DEVELOPER_DIR: '/Applications/Xcode_26.5.app'
IOS_SIMULATOR: 'iPhone 17'
WATCHOS_SIMULATOR: 'Apple Watch Series 11 (42mm)'
pool:
vmImage: $(imageName)
variables:
GIT_LFS_SKIP_SMUDGE: 1
steps:
- script: |
set -e -o xtrace
git submodule update --init --recursive
displayName: 'Update submodules'
- script: |
set -e -o xtrace
cd "Tests/Test Files"
echo "##vso[task.setvariable variable=lfsRev;]$(git rev-parse --verify HEAD)"
displayName: 'Generate assets-id'
- task: Cache@2
inputs:
key: '"swc_test_files_v5_" | "$(lfsRev)"'
path: 'Tests/Test Files'
displayName: 'Cache test files'
- script: |
set -e -o xtrace
xcrun simctl list > /dev/null
xcodebuild -downloadPlatform iOS
xcodebuild -downloadPlatform watchOS
xcodebuild -downloadPlatform tvOS
displayName: 'Install Darwin platforms'
- script: ./utils.py ci script-macos
displayName: 'Build & Test'
- script: swift build -c release
displayName: 'Build SPM Release'
- job: linux
strategy:
matrix:
linuxSwift60:
imageName: 'ubuntu-24.04'
containerImage: 'swift:6.0.3-noble'
linuxSwift61:
imageName: 'ubuntu-24.04'
containerImage: 'swift:6.1.3-noble'
linuxSwift62:
imageName: 'ubuntu-24.04'
containerImage: 'swift:6.2.3-noble'
linuxSwift63:
imageName: 'ubuntu-24.04'
containerImage: 'swift:6.3.2-noble'
pool:
vmImage: $(imageName)
container: $[ variables['containerImage'] ]
steps:
- script: |
set -e -o xtrace
git submodule update --init --recursive
displayName: 'Update submodules'
- script: |
set -e -o xtrace
cd "Tests/Test Files"
echo "##vso[task.setvariable variable=lfsRev;]$(git rev-parse --verify HEAD)"
displayName: 'Generate assets-id'
- task: Cache@2
inputs:
key: '"swc_test_files_v5_" | "$(lfsRev)"'
path: 'Tests/Test Files'
displayName: 'Cache test files'
- script: |
set -e -o xtrace
swift --version
swift test
displayName: 'SPM Test'
- script: |
set -e -o xtrace
swift --version
swift build -c release
displayName: 'SPM Build Release'
- job: windows
strategy:
matrix:
windowsSwift60:
imageName: 'windows-2022'
containerImage: 'swift:6.0.3-windowsservercore-ltsc2022'
windowsSwift61:
imageName: 'windows-2022'
containerImage: 'swift:6.1.3-windowsservercore-ltsc2022'
windowsSwift62:
imageName: 'windows-2022'
containerImage: 'swift:6.2.3-windowsservercore-ltsc2022'
windowsSwift63:
imageName: 'windows-2022'
containerImage: 'swift:6.3.2-windowsservercore-ltsc2022'
pool:
vmImage: $(imageName)
container: $[ variables['containerImage'] ]
steps:
- script: |
git.exe submodule update --init --recursive
displayName: 'Update submodules'
- powershell: |
cd "Tests\Test Files"
Write-Host "##vso[task.setvariable variable=lfsRev;]$(git.exe rev-parse --verify HEAD)"
displayName: 'Generate assets-id'
- task: Cache@2
inputs:
key: '"swc_test_files_v5_" | "$(lfsRev)"'
path: 'Tests/Test Files'
displayName: 'Cache test files'
- script: |
swift.exe --version
swift.exe test
displayName: 'SPM Test'
- script: |
swift.exe --version
swift.exe build -c release
displayName: 'SPM Build Release'
- stage: deploy
displayName: Deploy
dependsOn: test
# Deploy on tags only; test tags are excluded in trigger section.
condition: and(not(eq(variables['Build.Reason'], 'PullRequest')), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
jobs:
- job: ghPages
displayName: 'Publish API docs to GH Pages'
pool:
vmImage: 'macOS-26'
steps:
- script: |
set -e -o xtrace
brew update
brew install sourcekitten
gem install -N jazzy
displayName: 'Install Tools'
- task: InstallSSHKey@0
inputs:
knownHostsEntry: 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk='
sshPublicKey: '$(swcPubDeployKey)'
sshKeySecureFile: 'swc_deploy_key'
displayName: 'Install an SSH key'
- script: git worktree add docs gh-pages
displayName: 'Prepare Worktree'
- script: ./utils.py ci before-deploy
displayName: 'Before Deploy'
- script: |
set -e -o xtrace
git config --local user.name "Azure Pipelines"
git config --local user.email "azuredevops@microsoft.com"
cd docs
git add --all
git commit -m "Deploy to GH Pages [skip ci]" --amend
cd ..
git remote set-url --push origin git@github.com:tsolomko/SWCompression.git
git push --force origin gh-pages:gh-pages
displayName: 'Deploy to GH Pages'