Migrate to Swift 5️⃣.9️⃣ #179
Workflow file for this run
This file contains 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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '[0-9]+\.[0-9]+\.[0-9]+' | |
pull_request: | |
branches: | |
- master | |
env: | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#xcode | |
DEVELOPER_DIR: "/Applications/Xcode_15.2.app/Contents/Developer" | |
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone 15 Pro,OS=latest" | |
jobs: | |
env-details: | |
name: Environment details | |
runs-on: macos-14 | |
steps: | |
- name: xcode version | |
run: xcodebuild -version -sdk | |
- name: list simulators | |
run: | | |
xcrun simctl delete unavailable | |
xcrun simctl list | |
- name: brew version | |
run: brew --version | |
build-test: | |
name: Build and Test | |
runs-on: macos-14 | |
env: | |
WORKSPACE: Alicerce.xcworkspace | |
SCHEME: Alicerce | |
DERIVED_DATA_PATH: /tmp/DerivedData | |
SPM_CLONED_DEPENDENCIES_PATH: /tmp/spm-dependencies | |
RESULT_BUNDLE_PATH: build-test.xcresult | |
LOG_PATH: xcodebuild.log | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: set Homebrew cache path | |
run: | | |
HOMEBREW_CACHE_DIR="$(brew --cache)" | |
echo "Homebrew cache directory: $HOMEBREW_CACHE_DIR" | |
echo "HOMEBREW_CACHE_PATH=$HOMEBREW_CACHE_DIR" >> "$GITHUB_ENV" | |
- name: cache Homebrew | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.HOMEBREW_CACHE_PATH }} | |
key: ${{ runner.os }}-brew-${{ hashFiles('**/Brewfile.lock.json') }} | |
restore-keys: ${{ runner.os }}-brew- | |
- name: install Homebrew formulas | |
run: | | |
brew update | |
brew bundle install | |
- name: cache SPM | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.SPM_CLONED_DEPENDENCIES_PATH }} | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: ${{ runner.os }}-spm- | |
- name: cache DerivedData | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.DERIVED_DATA_PATH }} | |
key: ${{ runner.os }}-DerivedData-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: ${{ runner.os }}-DerivedData- | |
- name: unit tests | |
run: | | |
set -o pipefail | |
xcodebuild clean build test \ | |
-workspace "$WORKSPACE" \ | |
-scheme "$SCHEME" \ | |
-destination "$IOS_DESTINATION" \ | |
-derivedDataPath "$DERIVED_DATA_PATH" \ | |
-enableCodeCoverage YES \ | |
-resultBundlePath "$RESULT_BUNDLE_PATH" \ | |
-onlyUsePackageVersionsFromResolvedFile \ | |
-skipPackagePluginValidation \ | |
-skipMacroValidation \ | |
-clonedSourcePackagesDirPath $SPM_CLONED_DEPENDENCIES_PATH \ | |
| tee $LOG_PATH \ | |
| xcbeautify | |
- name: codecov upload | |
uses: codecov/codecov-action@v4 | |
with: | |
xcode: true | |
xcode_archive_path: ${{ env.RESULT_BUNDLE_PATH }} | |
- name: Archive artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: | | |
${{ env.RESULT_BUNDLE_PATH }} | |
${{ env.LOG_PATH }} | |
swiftpm: | |
name: SwiftPM Build | |
runs-on: macos-14 | |
env: | |
WORKSPACE: Alicerce.xcworkspace | |
SCHEME: "Alicerce (SPM)" | |
DERIVED_DATA_PATH: /tmp/DerivedData | |
SPM_CLONED_DEPENDENCIES_PATH: /tmp/spm-dependencies | |
LOG_PATH: spm-xcodebuild.log | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: set Homebrew cache path | |
run: | | |
HOMEBREW_CACHE_DIR="$(brew --cache)" | |
echo "Homebrew cache directory: $HOMEBREW_CACHE_DIR" | |
echo "HOMEBREW_CACHE_PATH=$HOMEBREW_CACHE_DIR" >> "$GITHUB_ENV" | |
- name: cache Homebrew | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.HOMEBREW_CACHE_PATH }} | |
key: ${{ runner.os }}-brew-${{ hashFiles('**/Brewfile.lock.json') }} | |
restore-keys: ${{ runner.os }}-brew- | |
- name: install Homebrew formulas | |
run: | | |
brew update | |
brew bundle install | |
- name: cache SPM | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.SPM_CLONED_DEPENDENCIES_PATH }} | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: ${{ runner.os }}-spm- | |
- name: cache DerivedData | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.DERIVED_DATA_PATH }} | |
key: ${{ runner.os }}-DerivedData-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: ${{ runner.os }}-DerivedData- | |
- name: build | |
run: | | |
set -o pipefail | |
xcodebuild clean build \ | |
-workspace "$WORKSPACE" \ | |
-scheme "$SCHEME" \ | |
-destination "$IOS_DESTINATION" \ | |
-derivedDataPath $DERIVED_DATA_PATH \ | |
-onlyUsePackageVersionsFromResolvedFile \ | |
-skipPackagePluginValidation \ | |
-skipMacroValidation \ | |
-clonedSourcePackagesDirPath $SPM_CLONED_DEPENDENCIES_PATH \ | |
| tee $LOG_PATH \ | |
| xcbeautify | |
- name: Archive logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spm-xcodebuild.log | |
path: ${{ env.LOG_PATH }} | |
cocoapods: | |
name: CocoaPods Verification | |
runs-on: macos-14 | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: ruby versions | |
run: | | |
ruby --version | |
gem --version | |
bundler --version | |
- name: cache gems | |
uses: actions/cache@v4 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: ${{ runner.os }}-gem- | |
- name: bundle install | |
run: | | |
gem install bundler --no-document | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: pod lint | |
run: bundle exec pod lib lint | |
carthage: | |
name: Carthage Verification | |
runs-on: macos-14 | |
env: | |
DERIVED_DATA_PATH: /tmp/DerivedData | |
LOG_PATH: carthage.log | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: set Homebrew cache path | |
run: | | |
HOMEBREW_CACHE_DIR="$(brew --cache)" | |
echo "Homebrew cache directory: $HOMEBREW_CACHE_DIR" | |
echo "HOMEBREW_CACHE_PATH=$HOMEBREW_CACHE_DIR" >> "$GITHUB_ENV" | |
- name: cache Homebrew | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.HOMEBREW_CACHE_PATH }} | |
key: ${{ runner.os }}-brew-${{ hashFiles('**/Brewfile.lock.json') }} | |
restore-keys: ${{ runner.os }}-brew- | |
- name: install Homebrew formulas | |
run: | | |
brew update | |
brew bundle install | |
- name: cache DerivedData | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.DERIVED_DATA_PATH }} | |
key: ${{ runner.os }}-DerivedData-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: ${{ runner.os }}-DerivedData- | |
- name: carthage build | |
run: | | |
defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES | |
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES | |
# remove SPM scheme because Carthage builds all shared schemes... | |
rm ".swiftpm/xcode/xcshareddata/xcschemes/Alicerce (SPM).xcscheme" | |
./script/carthage.sh build \ | |
--cache-builds \ | |
--no-skip-current \ | |
--toolchain iphonesimulator17.2 \ | |
--use-xcframeworks \ | |
--derived-data $DERIVED_DATA_PATH \ | |
--verbose \ | |
--log-path $LOG_PATH | |
- name: Archive logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: carthage.log | |
path: ${{ env.LOG_PATH }} | |
release-github: | |
name: GitHub Release | |
runs-on: macos-14 | |
needs: [build-test, swiftpm, cocoapods, carthage] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body: | | |
# Changes | |
- <!-- Insert changes here --> | |
release-cocoapods: | |
name: CocoaPods Release | |
runs-on: macos-14 | |
needs: [build-test, swiftpm, cocoapods, carthage] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: ruby versions | |
run: | | |
ruby --version | |
gem --version | |
bundler --version | |
- name: cache gems | |
uses: actions/cache@v4 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: ${{ runner.os }}-gem- | |
- name: bundle install | |
run: | | |
gem install bundler --no-document | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: pod trunk push | |
env: | |
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | |
run: pod trunk push --allow-warnings |