-
-
Notifications
You must be signed in to change notification settings - Fork 122
Check final status for workflow jobs #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Goooler
wants to merge
13
commits into
sozercan:main
Choose a base branch
from
Goooler:ci-checks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
72b53ee
Add a final-status check on CI
Goooler 7416951
Update .github/workflows/ci.yml
Goooler 835fd78
Merge branch 'sozercan:main' into ci-checks
Goooler cd74f3a
Merge remote-tracking branch 'origin/main' into ci-checks
Goooler 93584c1
Rename jobs
Goooler 5111af8
Cache build dirs
Goooler abc4454
Merge remote-tracking branch 'origin/main' into ci-checks
Goooler f03c4be
Revert "Cache build dirs"
Goooler 427075e
Merge remote-tracking branch 'origin/main' into ci-checks
Goooler 6b0b489
Fix merge
Goooler 70900ae
Update comments
Goooler 509fc1d
Merge remote-tracking branch 'origin/main' into ci-checks
Goooler 935ce1f
Fix merge
Goooler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| name: CI | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| swiftlint: | ||
| name: Swift Lint | ||
| runs-on: macos-26 | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| - run: brew install swiftlint | ||
| - name: Run SwiftLint | ||
| run: | | ||
| swiftlint lint --strict --reporter github-actions-logging | ||
|
|
||
| swiftformat: | ||
| name: Swift Format | ||
| runs-on: macos-26 | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| - run: brew install swiftformat | ||
| - name: Check formatting | ||
| run: | | ||
| swiftformat --lint . 2>&1 || { | ||
| echo "::error::Code is not formatted. Run 'swiftformat .' locally and commit the changes." | ||
| exit 1 | ||
| } | ||
|
|
||
| macos_unit_tests: | ||
| name: macOS Unit Tests | ||
| timeout-minutes: 20 | ||
| runs-on: macos-26 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| - name: Select Xcode version | ||
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | ||
| - name: Show Swift version | ||
| run: swift --version | ||
| - name: Clear SPM artifacts cache | ||
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | ||
| - name: Run unit tests | ||
| run: swift test -q --skip KasetUITests | ||
| - name: Upload test results on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 | ||
| with: | ||
| name: macOS-TestResults | ||
| path: ./build/*.xcresult | ||
| retention-days: 7 | ||
|
|
||
| macos_ui_tests: | ||
| name: macOS UI Tests | ||
| timeout-minutes: 30 | ||
| runs-on: macos-26 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| - name: Select Xcode version | ||
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | ||
| - name: Show Xcode version | ||
| run: xcodebuild -version | ||
| - name: Clear SPM artifacts cache | ||
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | ||
| - name: Build app bundle for UI tests | ||
| env: | ||
| KASET_SIGNING: adhoc | ||
| run: Scripts/build-app.sh debug | ||
| - name: Install app for UI tests | ||
| run: | | ||
| sudo cp -R .build/app/Kaset.app /Applications/Kaset.app | ||
| # Register with Launch Services so XCUIApplication can find it | ||
| /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f /Applications/Kaset.app | ||
| - name: Run UI tests | ||
| run: | | ||
| set -o pipefail | ||
| xcodebuild \ | ||
| -project KasetUITests.xcodeproj \ | ||
| -scheme KasetUITests \ | ||
| -destination 'platform=macOS' \ | ||
| -derivedDataPath ./build \ | ||
| CODE_SIGN_IDENTITY="-" \ | ||
| CODE_SIGNING_REQUIRED=NO \ | ||
| CODE_SIGNING_ALLOWED=NO \ | ||
| test | ||
| - name: Upload test results on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 | ||
| with: | ||
| name: macOS-UITestResults | ||
| path: ./build/*.xcresult | ||
| retention-days: 7 | ||
|
|
||
| build: | ||
|
Goooler marked this conversation as resolved.
|
||
| name: Build | ||
| runs-on: macos-26 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| - name: Select Xcode version | ||
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | ||
| - name: Show Swift version | ||
| run: swift --version | ||
| - name: Clear SPM artifacts cache | ||
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | ||
| - name: Get short SHA | ||
| id: slug | ||
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
| - name: Build app | ||
| env: | ||
| KASET_SIGNING: adhoc | ||
| ARCHES: "arm64 x86_64" | ||
| run: | | ||
| # Override version for dev builds | ||
| echo "MARKETING_VERSION=0.0.0-dev.${{ steps.slug.outputs.sha_short }}" > version.env | ||
| echo "BUILD_NUMBER=${{ github.run_number }}" >> version.env | ||
| Scripts/build-app.sh release | ||
|
|
||
| - name: Create DMG | ||
| run: | | ||
| APP_PATH=".build/app/Kaset.app" | ||
|
|
||
| if [ ! -d "$APP_PATH" ]; then | ||
| echo "Error: Could not find Kaset.app" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found app at: $APP_PATH" | ||
|
|
||
| # Create a temporary directory for DMG contents | ||
| mkdir -p dmg_contents | ||
| cp -R "$APP_PATH" dmg_contents/ | ||
|
|
||
| # Create DMG | ||
| hdiutil create -volname "Kaset-dev" \ | ||
| -srcfolder dmg_contents \ | ||
| -ov -format UDZO \ | ||
| kaset-dev.dmg | ||
| - name: Upload DMG | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 | ||
| if: github.event_name != 'pull_request' | ||
| with: | ||
| name: kaset-dev-${{ steps.slug.outputs.sha_short }} | ||
| path: kaset-dev.dmg | ||
| retention-days: 30 | ||
|
|
||
| # Status check that is required in branch protection rules. | ||
| final-status: | ||
| name: Final Status | ||
| needs: | ||
| - swiftlint | ||
| - swiftformat | ||
| - macos_unit_tests | ||
| - macos_ui_tests | ||
| - build | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| steps: | ||
| - name: Check | ||
| run: | | ||
| results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}') | ||
| if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then | ||
|
Goooler marked this conversation as resolved.
Goooler marked this conversation as resolved.
|
||
| echo "One or more required jobs failed" | ||
| exit 1 | ||
| fi | ||
| echo "All required jobs completed successfully." | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like this but its removing filtering based on files so a change in readme doesn't trigger a full ci run
can we use something like https://github.com/dorny/paths-filter to add a filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's intended. Removing all filters ensures all file changes will trigger the workflow.