mirror of
https://github.com/otaviocc/Triton.git
synced 2026-01-29 19:54:27 +00:00
Add GitHub Actions workflow for PR checks
This workflow runs automated checks on pull requests to ensure code quality: - Builds the OMG project using xcodebuild with the OMG scheme - Validates code formatting using swiftformat with the project's .swiftformat configuration - Caches Swift Package Manager dependencies to optimize build times - Runs on all pull requests targeting main and develop branches The workflow helps maintain code quality and consistency by catching build failures and formatting issues before code is merged.
This commit is contained in:
parent
27f4998cdf
commit
05e3920841
1 changed files with 58 additions and 0 deletions
58
.github/workflows/pr-checks.yml
vendored
Normal file
58
.github/workflows/pr-checks.yml
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
name: Pull Request Checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
build-and-format:
|
||||
name: Build and Format Check
|
||||
runs-on: macos-26
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Select Xcode version
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '26.1.1'
|
||||
|
||||
- name: Show Xcode version
|
||||
run: xcodebuild -version
|
||||
|
||||
- name: Cache Swift Package Manager
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
.build
|
||||
~/Library/Developer/Xcode/DerivedData
|
||||
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-spm-
|
||||
|
||||
- name: Resolve Swift Package dependencies
|
||||
run: xcodebuild -resolvePackageDependencies -project OMG.xcodeproj -scheme OMG
|
||||
|
||||
- name: Build OMG
|
||||
run: |
|
||||
xcodebuild build \
|
||||
-project OMG.xcodeproj \
|
||||
-scheme OMG \
|
||||
-configuration Debug \
|
||||
-destination 'platform=macOS' \
|
||||
| xcpretty || exit 1
|
||||
continue-on-error: false
|
||||
|
||||
- name: Install swiftformat
|
||||
run: brew install swiftformat
|
||||
|
||||
- name: Check code formatting
|
||||
run: |
|
||||
swiftformat --lint .
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Code formatting issues detected. Please run 'swiftformat .' locally to fix."
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Reference in a new issue