Skip to content

Commit

Permalink
Build on each XCode version available on the runner
Browse files Browse the repository at this point in the history
  • Loading branch information
stoyicker committed Apr 16, 2024
1 parent 8e4a760 commit 00a1d68
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 9 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,38 @@ on:
branches:
- '**'
jobs:
root:
generate-build-matrix:
runs-on: macos-14-xlarge
outputs:
xcodeversions: ${{ steps.generate.outputs.xcodeversions }}
steps:
- id: generate
run: |
version_list=()
for XCODE_INSTALL in $(ls /Applications | grep Xcode); do
version_list+=("$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" /Applications/$XCODE_INSTALL/Contents/Info.plist)")
done
unique_version_list=( $(printf "%s\n" ${version_list[@]} | sort -n -u) )
jsonString="$(jq -c --null-input '$ARGS.positional' --args -- "${unique_version_list[@]}")"
echo "xcodeversions=$jsonString" >> $GITHUB_OUTPUT
build:
runs-on: macos-14-xlarge
needs: [ generate-build-matrix ]
strategy:
matrix:
xcodeversion: ${{ fromJSON(needs.generate-build-matrix.outputs.xcodeversions) }}
exclude:
- version: 15.3 # https://youtrack.jetbrains.com/issue/KT-67465/cinterop-errors-when-compiling-with-Xcode-15.3-if-targetting-iosArm64-and-or-tvosArm64
steps:
- uses: actions/[email protected]
- uses: maxim-lobanov/[email protected]
with:
xcode-version: ${{ matrix.xcodeversion }}
- uses: ./.github/actions/runGradleTask
with:
task: build
barrier-build:
runs-on: ubuntu-22.04
needs: [ build ]
steps:
- run: exit 0
40 changes: 32 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ jobs:
ref: main
fetch-depth: 0
- run: exit $(git merge-base --is-ancestor $GITHUB_REF_NAME HEAD)
jvm-maven-github:
runs-on: macos-14-xlarge
needs: [ ensure-tag-is-on-main ]
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/runGradleTask
with:
preTaskString: -Pversion=$GITHUB_REF_NAME
task: library:publishKotlinMultiplatformPublicationToGithubPackagesRepository
create-github-release:
runs-on: ubuntu-22.04
needs: [ ensure-tag-is-on-main ]
Expand All @@ -27,28 +36,43 @@ jobs:
with:
name: upload_url
path: upload_url
jvm-maven-github:
generate-build-matrix:
runs-on: macos-14-xlarge
needs: [ ensure-tag-is-on-main ]
outputs:
xcodeversions: ${{ steps.generate.outputs.xcodeversions }}
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/runGradleTask
with:
preTaskString: -Pversion=$GITHUB_REF_NAME
task: library:publishKotlinMultiplatformPublicationToGithubPackagesRepository
- id: generate
run: |
version_list=()
for XCODE_INSTALL in $(ls /Applications | grep Xcode); do
version_list+=("$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" /Applications/$XCODE_INSTALL/Contents/Info.plist)")
done
unique_version_list=( $(printf "%s\n" ${version_list[@]} | sort -n -u) )
jsonString="$(jq -c --null-input '$ARGS.positional' --args -- "${unique_version_list[@]}")"
echo "xcodeversions=$jsonString" >> $GITHUB_OUTPUT
attach-xcframework-to-github-release:
runs-on: macos-14-xlarge
needs: [ create-github-release ]
needs: [ create-github-release, generate-build-matrix ]
strategy:
fail-fast: false
matrix:
xcodeversion: ${{ fromJSON(needs.generate-build-matrix.outputs.xcodeversions) }}
exclude:
- version: 15.3 # https://youtrack.jetbrains.com/issue/KT-67465/cinterop-errors-when-compiling-with-Xcode-15.3-if-targetting-iosArm64-and-or-tvosArm64
steps:
- uses: actions/[email protected]
- uses: maxim-lobanov/[email protected]
with:
xcode-version: ${{ matrix.xcodeversion }}
- uses: ./.github/actions/runGradleTask
with:
task: :library:assembleLibraryReleaseXCFramework
- run: zip -r Library.xcframework.zip library/build/XCFrameworks/release/library.xcframework
- uses: actions/[email protected]
with:
name: upload_url
- run: echo UPLOAD_URL=$(cat upload_url | sed "s/{?name,label}/?name=Library-${GITHUB_REF_NAME}.xcframework.zip/") >> $GITHUB_ENV
- run: echo UPLOAD_URL=$(cat upload_url | sed "s/{?name,label}/?name=Library-${GITHUB_REF_NAME}-xcodebuild-${{ matrix.xcodeversion }}.xcframework.zip/") >> $GITHUB_ENV
- run: |
curl -s \
-X POST \
Expand Down

0 comments on commit 00a1d68

Please sign in to comment.