Skip to content

Migrate to Swift 5️⃣.9️⃣ #172

Migrate to Swift 5️⃣.9️⃣

Migrate to Swift 5️⃣.9️⃣ #172

Workflow file for this run

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
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
ARTIFACTS_PATH: artifacts
RESULT_BUNDLE_PATH: $ARTIFACTS_PATH/build-test.xcresult
LOG_PATH: $ARTIFACTS_PATH/xcodebuild.log
steps:
- name: git checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: install xcbeautify
run: brew install xcbeautify
- name: cache SPM
uses: actions/cache@v2
with:
path: $SPM_CLONED_DEPENDENCIES_PATH
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- 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: $ARTIFACTS_PATH
swiftpm:
name: SwiftPM Build
runs-on: macos-14
env:
WORKSPACE: Alicerce.xcworkspace
SCHEME: "Alicerce (SPM)"
SPM_CLONED_DEPENDENCIES_PATH: /tmp/spm-dependencies
LOG_PATH: spm-xcodebuild.log
steps:
- name: git checkout
uses: actions/checkout@v3
- name: install xcbeautify
run: brew install xcbeautify
- name: cache SPM
uses: actions/cache@v2
with:
path: $SPM_CLONED_DEPENDENCIES_PATH
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- name: build
run: |
set -o pipefail
xcodebuild clean build \
-workspace "$WORKSPACE" \
-scheme "$SCHEME" \
-destination "$IOS_DESTINATION" \
-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: $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@v2
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: carthage build
run: |
./script/carthage.sh build \
--cache-builds \
--no-skip-current \
--derived-data $DERIVED_DATA_PATH \
--log-path $LOG_PATH
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: carthage.log
path: $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