Move remaining CI jobs to GitHub Actions (#3822)

Analyze, TSan, Xcode & Docs
This commit is contained in:
JP Simard 2022-01-24 23:29:33 -05:00 committed by GitHub
parent 006bb2a85e
commit 4525e9999b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 108 additions and 102 deletions

54
.github/workflows/docs.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: Docs
on:
push:
branches: [master]
pull_request:
branches: ['*']
jobs:
Docs:
runs-on: macos-latest
env:
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
steps:
- uses: actions/checkout@v2
- name: bundle install
run: bundle install
- name: Run swiftlint generate-docs
run: swift run swiftlint generate-docs
- name: Run jazzy
run: bundle exec jazzy
- name: Validate documentation coverage
run: |
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
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: API Docs
path: docs
- name: Push to gh-pages
if: github.event_name == 'push'
run: |
git config --global user.email "${GITHUB_ACTOR}"
git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com"
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" out
cd out
git checkout gh-pages
git rm -rf .
cd ..
cp -a docs/. out/.
cd out
git add -A
git commit -m "Automated deployment to GitHub Pages: ${GITHUB_SHA}" --allow-empty
git push origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

22
.github/workflows/tsan.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: TSan
on:
push:
branches: [master]
pull_request:
branches: ['*']
jobs:
tsan:
name: TSan
runs-on: macos-latest
env:
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
steps:
- uses: actions/checkout@v2
- run: swift run --sanitize=thread swiftlint lint --lenient
name: Pre-cache SwiftLint Run
- run: swift run --sanitize=thread swiftlint lint --lenient
name: Post-cache SwiftLint Run
- run: make test_tsan
name: Test With TSan

24
.github/workflows/xcodebuild.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: xcodebuild
on:
push:
branches: [master]
pull_request:
branches: ['*']
jobs:
Xcode:
strategy:
matrix:
xcode_version: ['12.5.1', '13.0', '13.2.1']
runs-on: macos-11
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
steps:
- uses: actions/checkout@v2
- run: xcodebuild -scheme swiftlint test -destination "platform=macOS" | xcpretty -r junit -o build/reports/xcodebuild.xml
name: xcodebuild test
- run: bash <(curl -s https://codecov.io/bash)
name: Export code coverage
if: matrix.xcode_version == '13.2.1'
env: { 'CODECOV_TOKEN': '${{ secrets.CODECOV_TOKEN }}' }

View File

@ -7,8 +7,14 @@ 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.
[![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)
[![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/analyze.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/pod_lib_lint.yml)
[![Docker](https://github.com/realm/SwiftLint/actions/workflows/analyze.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/docker.yml)
[![Docs](https://github.com/realm/SwiftLint/actions/workflows/analyze.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/docs.yml)
[![SwiftPM](https://github.com/realm/SwiftLint/actions/workflows/analyze.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/swiftpm.yml)
[![TSan](https://github.com/realm/SwiftLint/actions/workflows/analyze.yml/badge.svg)](https://github.com/realm/SwiftLint/actions/workflows/tsan.yml)
[![Xcode](https://github.com/realm/SwiftLint/actions/workflows/analyze.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)
![](assets/screenshot.png)

View File

@ -1,75 +0,0 @@
trigger:
- master
jobs:
- 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: 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')

View File

@ -1,25 +0,0 @@
#!/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