Demo app with Swift Package #376
Workflow file for this run
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' | |
- '!Sources/Common/ApplicationInfo.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-14 | |
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@v4 | |
env: | |
cache-name: swiftpm | |
with: | |
path: .build | |
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}- | |
${{ runner.os }}-${{ github.job }}- | |
${{ runner.os }}- | |
- name: Disable SwiftLint Plugin | |
run: sed -i -e 's/.*SwiftLint.*//g' Package.swift | |
- name: Test | |
run: ./scripts/test.sh | |
- name: Upload test results | |
if: ${{ matrix.xcode_version == fromJson(needs.generate-matrix.outputs.matrix).xcode_version[0] && (success() || failure()) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: BuildConfig.swift.xcresult | |
path: test_output/BuildConfig.swift.xcresult | |
test_demo: | |
name: Test demo app | |
needs: generate-matrix | |
runs-on: macOS-14 | |
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@v4 | |
env: | |
cache-name: swiftpm | |
with: | |
path: | | |
Demo/.build | |
Demo/Tools/.build | |
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}- | |
${{ runner.os }}-${{ github.job }}- | |
${{ runner.os }}- | |
- name: Cache DerivedData | |
uses: actions/cache@v4 | |
env: | |
cache-name: derived-data | |
with: | |
path: Demo/DerivedData | |
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}- | |
${{ runner.os }}-${{ github.job }}- | |
${{ runner.os }}- | |
- name: Disable SwiftLint Plugin | |
run: sed -i -e 's/.*SwiftLint.*//g' Package.swift | |
- name: test | |
run: ./scripts/test_demo.sh | |
- name: upload test results | |
if: ${{ matrix.xcode_version == fromJson(needs.generate-matrix.outputs.matrix).xcode_version[0] && (success() || failure()) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: BuildConfigDemo.xcresult | |
path: test_output/BuildConfigDemo.xcresult | |
test_demo_with_package: | |
name: Test package based demo app | |
needs: generate-matrix | |
runs-on: macOS-14 | |
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@v4 | |
env: | |
cache-name: swiftpm | |
with: | |
path: | | |
DemoWithPackage/.build | |
DemoWithPackage/Tools/.build | |
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}- | |
${{ runner.os }}-${{ github.job }}- | |
${{ runner.os }}- | |
- name: Cache DerivedData | |
uses: actions/cache@v4 | |
env: | |
cache-name: derived-data | |
with: | |
path: DemoWithPackage/DerivedData | |
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}- | |
${{ runner.os }}-${{ github.job }}- | |
${{ runner.os }}- | |
- name: Disable SwiftLint Plugin | |
run: sed -i -e 's/.*SwiftLint.*//g' Package.swift | |
- name: test | |
run: ./scripts/test_demo_package.sh | |
- name: upload test results | |
if: ${{ matrix.xcode_version == fromJson(needs.generate-matrix.outputs.matrix).xcode_version[0] && (success() || failure()) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: BuildConfigDemoPackage.xcresult | |
path: test_output/BuildConfigDemoPackage.xcresult | |
report: | |
name: Report | |
needs: [test, test_demo] | |
runs-on: macOS-14 | |
if: ${{ (success() || failure()) }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: test_output | |
- run: ls -la test_output | |
- uses: kishikawakatsumi/xcresulttool@v1 | |
with: | |
path: | | |
test_output/BuildConfig.swift.xcresult | |
test_output/BuildConfigDemo.xcresult | |
show-passed-tests: false | |
show-code-coverage: false | |
danger: | |
name: Danger | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Disable SwiftLint Plugin | |
run: sed -i -e 's/.*SwiftLint.*//g' Package.swift | |
- name: Copy .swiftlint.yml for demo app | |
run: sh ./scripts/copy-lint-config.sh | |
- uses: 417-72KI/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |