GitHub Actions swift-tools-version 5.7.0 - swift

I am interested in running build for my Swift project on CI with GitHub Actions
I use the following ci.yml:
Build:
runs-on: macOS-latest
steps:
- name: Install Swift
uses: slashmo/install-swift#v0.2.1
with:
version: 5.7
- name: Checkout
uses: actions/checkout#v1
- name: Build
uses: sersoft-gmbh/xcodebuild-action#v2
with:
project: <Project>.xcodeproj
scheme: <Scheme>
destination: "platform=iOS Simulator,name=iPhone 14 Pro Max"
action: build
I am facing a problem here:
xcodebuild: error: Could not resolve package dependencies:
package at '/Users/runner/work/path/to/my/package' is using Swift tools version 5.7.0 but the installed version is 5.5.0
I want to use swift-tools-version equal to 5.7.0, not the lower one
Please, help me install the version I need

Looks like I made it work. I added this step in my workflow:
- name: Select Xcode
run: sudo xcode-select -s "/Applications/Xcode_14.0.1.app"
and then specified the simulator environment:
env:
destination: 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.0'

Related

How to cache java installation using github actions pipeline

I am installing JAVA with actions pipeline in github. To make faster the execution, I want to cache the java for next pipeline. The version I wanna use is 17 for JAVA. During first execution of pipeline, the specific version of java is installed correctly. When pipeline executed for 2nd time, the cached java is picked(Which I want too as well) but the it showing me the version 1.8 not 17. Can anyone help. Thanks
name: pipeline to install & cache java
on:
push:
branches:
- do/cs # or the name of your main branch
# manually run from the Actions tab
workflow_dispatch:
jobs:
build:
name: Install packeges
runs-on: windows-2019 # Win 10 IoT is not available on github actions
steps:
- name: Cache Java
id: cache-java
uses: actions/cache#v3
with:
path: 'c:\hostedtoolcache\windows\Java_Microsoft_jdk\17.0.3\x64'
key: ${{ runner.os }}-jdk-17.0.3
restore-keys: ${{ runner.os }}-jdk-17.0.3
- name: Install Java
if: ${{steps.cache-java.outputs.cache-hit != 'true'}} # condition to check if old installation is available in cache
uses: actions/setup-java#v3
with:
distribution: 'microsoft'
java-version: '17'
architecture: 'x64'
- name: Verify Java installation
run: |
echo "java version:"
java -version

Error in Github Actions - CompileSwift normal arm64 (in target 'Charts' from project 'Charts')

I am using Charts in my app and I am trying to run a CI/CD pipeline in Github Actions. Charts is added to the project via SwiftPackageManager.
Currently, the app builds and runs on my local machine, but when I am building in Github Actions, I am getting the following error:
CompileSwift normal arm64 (in target 'Charts' from project 'Charts')
Any idea how to fix this? The workflow files looks like this:
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Swift
on:
push:
branches: [ "features" ]
jobs:
build:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout#v3
- name: Build
run: xcodebuild clean build -workspace GSH.xcworkspace -scheme GSH CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
Charts environment:
Charts version/Branch/Commit Number: 4.0.2
Xcode version: 13.3
Swift version: 5.0
Platform(s) running Charts: iOS
macOS version running Xcode: macOS Monterey 12.6

Github Actions Build for iOS Failing

I am new to Github actions and I was trying to make an action to attempt a build and see if the build passes or fails an Xcode iOS build but I keep getting the error
line 1: cd: Swift/: No such file or directory
6
Error: Process completed with exit code 1.
Any help would be appreciated!
Code:
name: Xcode build iOS 14
on: [push, pull_request]
jobs:
build:
runs-on: macos-11
steps:
- uses: actions/checkout#v2
- name: Select Xcode
run: sudo xcode-select -switch /Applications/Xcode_13.3.app
- name: Xcode version
run: /usr/bin/xcodebuild -version
- name: Xcode build
run: |
cd Swift/
xcodebuild clean build -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 12,OS=14.4'
I would try cd Swift instead of cd Swift/ , if you have Swift folder in your project.

Github Actions Flutter CI Error: No version of NDK matched

Project Repository
I've been push the commit
but, I got error
* What went wrong:
Execution failed for task ':app:stripReleaseDebugSymbols'.
> No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.0.6113669
Below is the CI code(Flutter CI - Customer):
name: Flutter CI - Customer
on:
push:
branches:
- master
paths:
- holinoti_customer/**
- .github/workflows/flutter-customer.yml
pull_request:
branches:
- master
paths:
- holinoti_customer/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2.0.0
- name: Set up JDK 11
uses: actions/setup-java#v1
with:
java-version: 11.0.2
- name: Android NDK toolchain Setup
uses: ravinderjangra/android-ndk-toolchain-setup#0.1
with:
api: '21'
arch: 'arm'
install-location: 'toolchains'
- uses: subosito/flutter-action#v1.1.1
with:
flutter-version: '1.12.x' # you can use 1.12
- name: Install dependencies
run: flutter pub get
working-directory: holinoti_customer
- name: Test Build
run: flutter build apk
working-directory: holinoti_customer
In my local project, I set the ndk path in android studio's project structure
However, this solution is can't applied on Github Action
So, I tried to use Android NDK toolchain Setup, but still fail
Instead of using the local.properties file, set ndkVersion in your build.gradle to match the one available on your CI server. i.e.
android {
ndkVersion "21.1.6352462"
}
(I'm assuming that your CI has updated to make r21b available since then, otherwise use the 21.0.blah version from the error message.)
That way your CI and your local build both use the same version.
That was the motivation for this change, btw: keeping builds reproducible. Previously your CI and your local builds were using different versions of the NDK, and that can be a surprising and annoying source of bugs :)
Check updates of SDK Tools update the NDK and CMake tools.

GitHub Action in swift workspace

I am trying to use Github Actions to run an xcodebuild command on my xcworkspace.
However, any configuration fails with the error Unable to find a destination matching the provided destination specifier: { platform: iOS Simulator, OS: latest, name:iPhone 11 Pro }
Here is my swift.yml file
name: Unit Tests
on: [push]
jobs:
test:
runs-on: macOS-latest
steps:
- uses: actions/checkout#v2
- name: List Simulators
run: xcrun instruments -s
- name: Run tests
run: xcodebuild test -workspace "MyWorkspace.xcworkspace" -scheme "MyScheme" -destination "platform=iOS Simulator,name=iPhone 11 Pro,OS=latest"
As you can see, I am also logging all available devices on the CI machine. This clearly shows me several iPhone 11 Pro (Max).
Things I already tried:
use specific OS version
lower build target
force Xcode version to 11.3
grep ID of a simulator from the above-mentioned list and use that instead of the name parameter
boot simulators before running tests
Am I missing anything obvious?
Cheers and happy coding.
Force Xcode version to Xcode 11.3 and clean test
name: Unit Tests
on: [push]
jobs:
test:
runs-on: macOS-latest
steps:
- uses: actions/checkout#v2
- name: Force Xcode 11
run: sudo xcode-select -switch /Applications/Xcode_11.3.app
- name: List Simulators
run: xcrun instruments -s
- name: Run tests
run: xcodebuild clean test -workspace 'MyWorkspace.xcworkspace' -scheme 'MyScheme' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest'