forked from realm/SwiftLint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Move back to Azure Pipelines (realm#3826)
Yesterday I started moving SwiftLint's CI jobs from Azure Pipelines to GitHub Actions, which has nicer integrations with GitHub's web UI and feels nicer & more lightweight overall. However, GitHub Actions has a serious limitation compared to Azure Pipelines, which is that it only has 5x macOS job concurrency vs Azure's 10x ([see Twitter](https://twitter.com/simjp/status/1326592600393068546)). This leads to significant queuing when merging PRs or pushing to PRs in a short span, which is the main way I work on SwiftLint when catching up on PR/issue backlog every few months. A quick timing check showed that a PR using Azure Pipelines (realm#3825) took 26m 47s vs GitHub Actions (realm#3824) took 32m 31s. These PRs were opened at a time when no other CI jobs were running, so even though Azure Pipelines already took 6 minutes less to run than GitHub Actions, that difference would be even larger if there had been other PRs triggering CI jobs at the same time. So I think the best move for the project for the time being is to stay with Azure Pipelines for its CI. If GitHub ever increases its macOS concurrency to match Azure Pipelines's 10x we can explore this again.
- Loading branch information
Showing
9 changed files
with
158 additions
and
175 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
trigger: | ||
- master | ||
|
||
jobs: | ||
- job: linux | ||
pool: | ||
vmImage: 'Ubuntu 18.04' | ||
strategy: | ||
maxParallel: 10 | ||
matrix: | ||
swift54: | ||
containerImage: swift:5.4 | ||
# TODO: swift:5.5 | ||
container: $[ variables['containerImage'] ] | ||
steps: | ||
- script: swift test --parallel | ||
displayName: swift test | ||
|
||
- job: Xcode | ||
pool: | ||
vmImage: 'macOS-11' | ||
strategy: | ||
maxParallel: 10 | ||
matrix: | ||
xcode125: | ||
DEVELOPER_DIR: /Applications/Xcode_12.5.1.app | ||
xcode13: | ||
DEVELOPER_DIR: /Applications/Xcode_13.0.app | ||
steps: | ||
- script: | | ||
sw_vers | ||
xcodebuild -version | ||
displayName: Version Informations | ||
- script: > | ||
set -o pipefail && | ||
xcodebuild -scheme swiftlint test -destination "platform=macOS" | | ||
xcpretty -r junit -o build/reports/xcodebuild.xml | ||
displayName: xcodebuild test | ||
- script: bash <(curl -s https://codecov.io/bash) | ||
displayName: Export code coverage | ||
- task: PublishTestResults@2 | ||
inputs: | ||
testRunner: JUnit | ||
testResultsFiles: build/reports/** | ||
condition: succeededOrFailed() | ||
|
||
- job: SwiftPM | ||
pool: | ||
vmImage: 'macOS-11' | ||
strategy: | ||
maxParallel: 10 | ||
matrix: | ||
xcode125: | ||
DEVELOPER_DIR: /Applications/Xcode_12.5.1.app | ||
xcode13: | ||
DEVELOPER_DIR: /Applications/Xcode_13.0.app | ||
steps: | ||
- script: | | ||
sw_vers | ||
xcodebuild -version | ||
displayName: Version Informations | ||
- script: > | ||
set -o pipefail && | ||
swift test --parallel | ||
displayName: swift test | ||
|
||
- job: CocoaPods | ||
pool: | ||
vmImage: 'macOS-11' | ||
variables: | ||
DEVELOPER_DIR: /Applications/Xcode_13.0.app | ||
steps: | ||
- script: bundle install --path vendor/bundle | ||
displayName: bundle install | ||
- script: bundle exec pod repo update | ||
displayName: pod repo update | ||
- script: bundle exec pod lib lint --verbose SwiftLintFramework.podspec | ||
displayName: pod lib lint | ||
|
||
- job: Analyze | ||
pool: | ||
vmImage: 'macOS-11' | ||
variables: | ||
DEVELOPER_DIR: /Applications/Xcode_13.0.app | ||
steps: | ||
- script: make analyze | ||
displayName: Run SwiftLint Analyze | ||
|
||
- job: TSan | ||
pool: | ||
vmImage: 'macOS-11' | ||
variables: | ||
DEVELOPER_DIR: /Applications/Xcode_13.0.app | ||
steps: | ||
- script: swift run --sanitize=thread swiftlint lint --lenient | ||
displayName: Pre-cache SwiftLint Run | ||
- script: swift run --sanitize=thread swiftlint lint --lenient | ||
displayName: Post-cache SwiftLint Run | ||
- script: make test_tsan | ||
displayName: Test With TSan | ||
|
||
- job: jazzy | ||
pool: | ||
vmImage: 'macOS-11' | ||
variables: | ||
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app | ||
steps: | ||
- script: swift run swiftlint generate-docs | ||
displayName: Run swiftlint generate-docs | ||
- script: bundle install --path vendor/bundle | ||
displayName: bundle install | ||
- script: bundle exec jazzy | ||
displayName: Run jazzy | ||
- script: > | ||
if ruby -rjson -e "j = JSON.parse(File.read('docs/undocumented.json')); exit j['warnings'].length != 0"; then | ||
echo "Undocumented declarations:" | ||
cat docs/undocumented.json | ||
exit 1 | ||
fi | ||
displayName: Validate documentation coverage | ||
- task: PublishPipelineArtifact@0 | ||
inputs: | ||
artifactName: 'API Docs' | ||
targetPath: 'docs' | ||
- task: DownloadSecureFile@1 | ||
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master') | ||
inputs: | ||
secureFile: doc_deploy_key | ||
- script: ./script/push-docs | ||
displayName: Publish | ||
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p ~/.ssh && mv $DOWNLOADSECUREFILE_SECUREFILEPATH ~/.ssh/id_rsa | ||
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa | ||
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts | ||
|
||
source_sha="$(git rev-parse HEAD)" | ||
user="swiftlintbot@jpsim.com" | ||
git config --global user.email "$user" | ||
git config --global user.name "$user" | ||
git clone git@github.com:realm/SwiftLint.git out | ||
|
||
cd out | ||
git checkout gh-pages | ||
git rm -rf . | ||
rm -rf Carthage | ||
cd .. | ||
|
||
cp -a docs/. out/. | ||
cd out | ||
|
||
git add -A | ||
git commit -m "Automated deployment to GitHub Pages: ${source_sha}" --allow-empty | ||
|
||
git push origin gh-pages |