Skip to content

Commit

Permalink
build scheme for xcode and cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Aug 16, 2023
1 parent 0f439e0 commit 2391171
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test (CMake)

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build-cmake:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

# - name: Upgrade dependencies
# run: brew update && brew upgrade

- name: Install cmake
run: brew install cmake

- name: Build
run: cmake -S . -B build && cmake --build build

build-xcode:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

# - name: Upgrade dependencies
# run: brew update && brew upgrade

- name: Install cmake
run: brew install cmake

- name: Build
run: cmake -S . -B build -G Xcode && cmake --build build --config Release
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test CI/CD
name: Test (XCode)

on:
push:
Expand All @@ -13,18 +13,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Set Default Scheme
id: set-scheme
run: |
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo $default | cat >default
echo Using default scheme: $default
echo "Using default scheme: $default"
echo "::set-output name=scheme::$default"
- name: Build
env:
scheme: ${{ 'default' }}
run: |
if [ $scheme = default ]; then scheme=$(cat default); fi
scheme="${{ steps.set-scheme.outputs.scheme }}"
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}
xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Package.resolved
# .swiftpm

.build/
build/

# CocoaPods
#
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 2391171

Please sign in to comment.