Skip to content

Commit

Permalink
Workflows check for file changes (#349)
Browse files Browse the repository at this point in the history
* Workflows check for file changes

* Update build_example_project.yml

* Update codeql.yml

* Update swiftlint.yml

* Update build_and_test.yml

* Update build_example_project.yml

* Update codeql.yml

* Update build_and_test.yml

* Update build_and_test.yml

* Update build_and_test.yml

* Update build_and_test.yml

* Update build_and_test.yml

* Update build_and_test.yml

* Update build_example_project.yml

* Update codeql.yml

* Update build_example_project.yml

* Update build_and_test.yml

* Update build_example_project.yml

* Update codeql.yml

* Update codeql.yml

* Update deploy_documentation.yml

* Update deploy_documentation.yml
  • Loading branch information
simonbs authored Feb 23, 2024
1 parent 59c03c4 commit 3f5834c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 33 deletions.
37 changes: 25 additions & 12 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,55 @@ on:
pull_request:
branches:
- main
paths:
- '.github/workflows/build_and_test.yml'
- 'Sources/**'
- '!Sources/Runestone/Documentation.docc/**'
- 'Tests/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and test
name: Build and Test (Xcode ${{ matrix.xcode }})
runs-on: macos-14
continue-on-error: true
strategy:
matrix:
include:
- destination: iPhone 15 Pro
xcode: 15.2
- destination: iPhone 14 Pro
xcode: 14.3.1
- xcode: 15.2
destination: iPhone 15 Pro
os: 17.2
- xcode: 14.3.1
destination: iPhone 14 Pro
os: 16.4
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Check for changed files
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- '.github/workflows/build_and_test.yml'
- 'Sources/**'
- '!Sources/Runestone/Documentation.docc/**'
- 'Tests/**'
- name: Build
if: steps.changes.outputs.src == 'true'
run: |
set -o pipefail\
xcodebuild build-for-testing\
-scheme Runestone\
-sdk iphonesimulator\
-destination "platform=iOS Simulator,name=${{ matrix.destination }},OS=latest"
-destination "platform=iOS Simulator,name=${{ matrix.destination }},OS=${{ matrix.os }}"\
| xcbeautify --renderer github-actions
- name: Test
if: steps.changes.outputs.src == 'true'
run: |
set -o pipefail\
xcodebuild test-without-building\
-scheme Runestone\
-sdk iphonesimulator\
-destination "platform=iOS Simulator,name=${{ matrix.destination }},OS=latest"
-destination "platform=iOS Simulator,name=${{ matrix.destination }},OS=${{ matrix.os }}"\
| xcbeautify --renderer github-actions
28 changes: 18 additions & 10 deletions .github/workflows/build_example_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,46 @@ on:
pull_request:
branches:
- main
paths:
- '.github/workflows/build_example_project.yml'
- 'Example/**'
- 'Sources/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build example project
name: Build Example Project (Xcode ${{ matrix.xcode }})
runs-on: macos-14
continue-on-error: true
strategy:
matrix:
include:
- platform: iOS Simulator
- xcode: 15.2
destination: iPhone 15 Pro
xcode: 15.2
- platform: iOS Simulator
os: 17.2
- xcode: 14.3.1
destination: iPhone 14 Pro
xcode: 14.3.1
os: 16.4
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Check for changed files
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- '.github/workflows/build_example_project.yml'
- 'Example/**'
- 'Sources/**'
- name: Build
if: steps.changes.outputs.src == 'true'
run: |
set -o pipefail\
xcodebuild build\
-project Example/Example.xcodeproj\
-scheme Example\
-sdk iphonesimulator\
-destination "platform=${{ matrix.platform }},name=${{ matrix.destination }},OS=latest"
-destination "platform=iOS Simulator,name=${{ matrix.destination }},OS=${{ matrix.os }}"\
| xcbeautify --renderer github-actions
22 changes: 19 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer
XCODEBUILD_DESTINATION: iPhone 15 Pro
XCODEBUILD_OS: 17.2
jobs:
analyze:
name: Analyze
Expand All @@ -22,21 +23,36 @@ jobs:
matrix:
language: [ "swift", "c-cpp" ]
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Check for changed files
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- 'Example/**'
- 'Sources/**'
- 'Tests/**'
- 'UITests/**'
- name: Initialize CodeQL
if: steps.changes.outputs.src == 'true'
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Build
if: steps.changes.outputs.src == 'true'
run: |
set -o pipefail\
xcodebuild\
-scheme Runestone\
-sdk iphonesimulator\
-destination "platform=iOS Simulator,name=iPhone 15 Pro,OS=latest"
-destination "platform=iOS Simulator,name=${{ env.XCODEBUILD_DESTINATION }},OS=${{ env.XCODEBUILD_OS }}"\
| xcbeautify --renderer github-actions
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
if: steps.changes.outputs.src == 'true'
with:
category: "/language:${{matrix.language}}"
4 changes: 1 addition & 3 deletions .github/workflows/deploy_documentation.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: Deploy Documentation
on:
workflow_dispatch:
workflow_dispatch: {}
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
jobs:
build:
runs-on: macos-14
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: SwiftLint
on:
workflow_dispatch: {}
pull_request:
paths:
- '.github/workflows/swiftlint.yml'
- '.swiftlint.yml'
- '**/*.swift'
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down

0 comments on commit 3f5834c

Please sign in to comment.