Skip to content

Commit

Permalink
[CI] Move back to Azure Pipelines (realm#3826)
Browse files Browse the repository at this point in the history
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
jpsim authored Jan 25, 2022
1 parent c5ea00c commit 068f603
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 175 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/analyze.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/docs.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/pod_lib_lint.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/swiftpm.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/tsan.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/xcodebuild.yml

This file was deleted.

10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ SwiftLint hooks into [Clang](http://clang.llvm.org) and
[AST](http://clang.llvm.org/docs/IntroductionToTheClangAST.html) representation
of your source files for more accurate results.

[![Analyze](https://github.com/realm/SwiftLint/actions/workflows/analyze.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/analyze.yml)
[![CocoaPods](https://github.com/realm/SwiftLint/actions/workflows/pod_lib_lint.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/pod_lib_lint.yml)
[![Docker](https://github.com/realm/SwiftLint/actions/workflows/docker.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/docker.yml)
[![Docs](https://github.com/realm/SwiftLint/actions/workflows/docs.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/docs.yml)
[![SwiftPM](https://github.com/realm/SwiftLint/actions/workflows/swiftpm.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/swiftpm.yml)
[![TSan](https://github.com/realm/SwiftLint/actions/workflows/tsan.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/tsan.yml)
[![Xcode](https://github.com/realm/SwiftLint/actions/workflows/xcodebuild.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/xcodebuild.yml)
[![codecov](https://codecov.io/gh/realm/SwiftLint/branch/master/graph/badge.svg)](https://codecov.io/gh/realm/SwiftLint)
[![Build Status](https://dev.azure.com/jpsim/SwiftLint/_apis/build/status/realm.SwiftLint?branchName=master)](https://dev.azure.com/jpsim/SwiftLint/_build/latest?definitionId=4?branchName=master)
[![codecov.io](https://codecov.io/github/realm/SwiftLint/coverage.svg?branch=master)](https://codecov.io/github/realm/SwiftLint?branch=master)

![](assets/screenshot.png)

Expand Down
131 changes: 131 additions & 0 deletions azure-pipelines.yml
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')
25 changes: 25 additions & 0 deletions script/push-docs
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

0 comments on commit 068f603

Please sign in to comment.