Merge pull request #64 from 417-72KI/bool-and-number #231
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
name: CI | |
on: | |
push: | |
branches: main | |
paths: | |
- '**.swift' | |
- '.github/workflows/ci.yml' | |
pull_request: {} | |
concurrency: | |
group: ${{ github.head_ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
generate-matrix: | |
name: Generate matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: set-matrix | |
run: | | |
matrix=$(cat .github/matrix.json | jq -c .) | |
echo "matrix=$matrix" >> $GITHUB_OUTPUT | |
test: | |
name: Test | |
needs: generate-matrix | |
runs-on: macOS-12 | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache SPM build directory | |
uses: actions/cache@v3 | |
with: | |
path: .build | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.swift') }} | |
restore-keys: | | |
${{ runner.os }}-spm-${{ env.cache-name }}- | |
${{ runner.os }}-spm- | |
${{ runner.os }}- | |
- name: test via SwiftPM | |
run: set -o pipefail && swift test | |
- name: test via xcodebuild | |
run: | | |
set -o pipefail && \ | |
xcrun --sdk macosx xcodebuild \ | |
-enableCodeCoverage YES \ | |
-scheme "$(xcrun --sdk macosx xcodebuild -list -json | jq -rc '.workspace.schemes[] | select(. | startswith("BuildConfig"))')" \ | |
-destination "platform=macOS" \ | |
-clonedSourcePackagesDirPath '.build/SourcePackages' \ | |
-resultBundlePath 'test_output/BuildConfig.swift.xcresult' \ | |
clean test | xcpretty | |
- uses: kishikawakatsumi/xcresulttool@v1 | |
with: | |
path: test_output/BuildConfig.swift.xcresult | |
show-passed-tests: false | |
show-code-coverage: false | |
if: ${{ matrix.xcode_version == fromJson(needs.generate-matrix.outputs.matrix).xcode_version[0] && (success() || failure()) }} | |
danger: | |
name: Danger | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Copy .swiftlint.yml for demo app | |
run: sh ./scripts/copy-lint-config.sh | |
- uses: 417-72KI/danger-swiftlint@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |