Github action swiftUI project create dmg - macos

Let's consider the following problem, I have for example a project on Github for macOS in swiftUI.
I would like to make sure that through a Github action, I can create a dmg file for a release.
At the moment I haven't found Github action that allow you to do this.
I only found two libs that allow you to create dmg:
https://github.com/sindresorhus/create-dmg
https://github.com/create-dmg/create-dmg
If I wanted to create a Github Action that uses one of the two libs to create the dmg file, what could I do?
I thought of using the first one for example that I can install it via npm.
I thought of such a thing:
name: Release
on:
workflow_dispatch:
inputs:
jobs:
build:
name: Build
runs-on: macos-12
steps:
- uses: actions/checkout#master
- name: Install
run: npm install create-dmg
- name: Create
run: create-dmg 'NameApp.app' Build/Releases
But I get the following error:
Can you give me a hand?

Related

How can I get my github action to compile my rust program for Mac on Ubuntu

Attempting to compile a rust program for usage on Mac. Configured Github Action as follows:
build_macos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- name: Install required tools
run: sudo apt install libdbus-1-dev pkg-config libudev-dev libglfw3-dev libglew-dev
- name: Install required target
run: rustup target add aarch64-apple-darwin
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Build Release
run: cargo build --verbose --release --target=aarch64-apple-darwin
- name: Artifact MacOS
uses: actions/upload-artifact#v3
with:
name: Build MacOS
path: ./target/aarch64-apple-darwin/release/control_harts
retention-days: 5
which fails on Build Release Image
Investigating the log further points me to the following (full log):
= note: cc: error: unrecognized command-line option '-arch'
cc: error: unrecognized command-line option '-framework'
cc: error: unrecognized command-line option '-framework'
What would be the best way to solve this? If any further information is required, please let me know.
P.S. the program uses quite some libraries, but it does not appear to fail when compiling those, but only on the project itself. This makes me believe it maybe a configuration error on my end, but I cannot seem to figure that out.
P.P.S. the windows and linux tasks pass and produce a functioning executable, with all tests passing.
P.P.P.S. If it is preferable that I make a minimal piece of code or a repo that runs into this issue I could, but I am hoping the issue is just a simple oversight.
I was expecting a MacOS executable to pop out like the files for windows and linux do, but unfortunately the task runs into this error.
I tried looking for existing solutions for this problem, and I found:
(1, 2, 3 found after searching for the first line (-arch), 4 and 5 for the second line (-framework))
1. -> I cannot seem to configure these flags myself, as (from my very limited understanding) they are either part of the packages' build scripts or generated by rustc.
2. -> Unsolved github issue
3. -> Potentially solved github issue but it seems this is just part of the build script of that lib
4. -> Requires access to the MakeFile, which I may have but I cannot seem to figure out where it is.
5. -> for GoLang, and also without solution.
I was building with runs-on: ubuntu-latest as Azeem pointed out. After changing this to runs-on: macos-latest and removing the Install required tools task, it ran smoothly and created the distr as I wanted.
I cannot test this because I do not have a Mac, but the test cases pass so it seems ok.

Github actions, problem with dep installing

I have this go.yml for github actions
name: Test
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15
uses: actions/setup-go#v2
with:
go-version: 1.15
id: go
- name: Check out code
uses: actions/checkout#v2
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
It builds with error: home/runner/work/project/project is not within a known GOPATH/src
Error: Process completed with exit code 1.
How to fix it problem?
The default value of GOPATH is $HOME/go.
Your project folder is outside of this GOPATH hence the error.
You have two ways to fix this problem.
(Preferred) Update your project to use go.mod. It's the newer, nicer dependency management solution in go and doesn't require your project to be in GOPATH.
Assuming you are using Go version newer than 1.12, Remove the Gopkg.toml and Gopkg.lock (if you have it).
Run,
a. go mod init <project-name> Replace <project-name> with the name of your project.
b. Run go mod tidy and it'll add all the dependencies you are using in your project.
c. Run go build once to make sure your project still builds. If it doesn't, You can add the missing dependencies manually in go.mod.
Commit go.mod and go.sum(if you need deterministic builds).
Removed this from your CI config,
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
and just build the project. It should work.
Set the GOPATH correctly in your CI config before calling dep ensure. I think GOPATH=/home/runner/work/project/project should work but I am not aware of the exact specifics related to GOPATH so you'll just have to try.

Travis CI build is failing to start upon modifying YAML file

Upon modifying my YAML file (see below) and initiating a push to GitHub, Travis CI does not want to start running the tests.
language: r
os:
- osx
- linux
before_install:
- brew install llvm libomp
- export CPP=/usr/local/opt/llvm/bin/clang
notifications:
email:
- never
branches:
only:
- master
I have run my YAML file through the YAML Lint checker:
http://www.yamllint.com
and the file checks as valid.
I have also updated and upgraded Homebrew, but the issue still persists.
Anyone know what might be the culprit here?

Github Actions for Xcode

I am trying to get Github Actions to work with my Xcode project but it won't.
Here's my file
name: CI
on:
push:
branches:
- ci-test
jobs:
build:
runs-on: [macos-latest]
steps:
- name: Force xcode
run: sudo xcode-select -switch /Applications/Xcode_11.3.app
- name: Start xcodebuild test
# working-directory: 'My App'
run: xcodebuild clean test -workspace 'MyApp.xcworkspace' -scheme 'MyApp (Production)' -sdk iphonesimulator -destination 'name=iPhone 11 Pro Max,OS=13.3'
Further info:
This is the final version of the file. In most of my attempts, it complained about not finding my .xcworkspace.
This file resides in a specific feature branch, not on the master or a parent branch. I am not sure if this is relavent
The xcodebuild command works fine locally
Normally when I clone the repo on my Mac, the path is "where ever I choose/myapp-ios" and myapp-ios is the root directory where all my files including MyApp.xcworkspace are.
When I tried doing "pwd" in the action, it printed a weird path (I am assuming it's due to the action running in a virtual machine) however the path ended as follows "weird path/myapp-ios/myapp-ios"
I tried doing cd .. in the action file but that didn't work either
I tried doing git branch in the action file but I got an error indicating that it's not a git repository (I am guessing it means that it is not initialized)
I tried doing ls in the action file but it gave me bin/bash in the output instead of listing the files.
At this point I am not sure if the branch is wrong or if the path is wrong but in a test project, things worked smoothly by just specify the working directory and the action file was pretty much the same. It's worth noting that in the test project, cloning the project put all the files in another folder in the root directory, unlike this project. That's why I have omitted the working directory command from the file.
Not sure if you are still having trouble with this, but if so, I had to add the workspace prefix to get this to work correctly.
-workspace ${GITHUB_WORKSPACE}/MyApp.xcworkspace

How to setup Coverity Scan on GitHub with TravisCI?

I've managed to setup TravisCI for my C++ hosted on Github project, it works fine.
I would like to move on to static analysis of my C++ code with Coverity Scan.
Automatic upload with TravisCI to Scan Coverity is possible but I can't find a way to make it work.
My git repository is simple, there are two branches: master and coverity_scan.
To avoid triggering static analysis each time I'm pushing something, all stuff related to Scan Coverity is filled in coverity_scan branch:
language: cpp
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "UEHXnbNPk49F6Ta/+d+UZl74EhtIevExwCo1l6qBndw+LvIXQDNSfsFiIJsZVfSgacBEOtd7CSY6rtccDpGeS9oX5/G/pnCz/2Cu+NOCCWlpy/S3qcUtdz52nMVatTgRhEi14WfrghpHk7nxxSi1W5+VIBfew+In11V1Xln3W06hhGOOK17Ljik18LbjSY1K9yVwK60r3tzwzSBMm/MArsqCeigzw15c0THQUtLlaLg/5nfP31f1QV9W1WlF4zIHjzd0970M385vNDDPyG+qRCfMPDEJrWb9/hJVi5x2poHLDObSE25rSQqfzc5nfiSDbH888mkdbBZXSwMVveVEhufyEk0nxI0Tddh/WNYFs+7g1gyV9409Tj288Omx++zpb0jM7/++wgkRwvBnqfBN7GWxoZJ9rHTxauJ+IIOR1jvskCTFMFMLI3C1+IpT4SgV0i6v2PtRsdGbXgI9qywhmPEjC+lS6Nu/rZQItr27rZowvw1ITYwJrDX4YQOAZxJkYNLFdGfqEMSjx0nfq6Kpl/4PaHQ7X0OtnJNgssMk3LNcYEwV1tLhTt+qODONjB7yWilcsWo8yVurr4vnFS2nIV7N4XgBvJcZHWfovxiQhfJU2UQxDvCYlDJ0RpM8kxpze+LR2vh+BbYOgPcr7YKG9MoAbsQXDGiF7yTz1VjVQr4="
addons:
coverity_scan:
project:
name: LeFlou/Citadel
build_command_prepend: "cmake"
build_command: "make"
branch_pattern: coverity_scan
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- clang
compiler:
- gcc
- clang
before_script:
- cmake .
script:
- make
install:
# Use g++4.8 and not 4.6 (C++11 missing)
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
branches:
only:
- coverity_scan
I want to trigger static analysis only when I push to coverity_scan, not building on TravisCI.
However, continuous integration must be working on master branch.
For the moment, code is only built but never uploaded to Coverity Scan.
What's wrong in my configuration ?
Edit:
I noticed in TravisCI validator multiple addons generate errors, only the last entry is processed. On the other hand, coverity_scan seem to build without trouble (I need apt to install more recent versions of g++, this is related to C++11 features).
Edit 20150910:
I merged both addons sections and this works.
But I'm still stuck on "Submitted first build" step.
I also changed COVERITY_SCAN_TOKEN, still this does not submit the build to Coverity Scan
TravisCI build with these changes
I think your problem is in build_command_prepend, it's cmake . and not cmake.
I think the problem might be that you indicated the branch you are using as coverity_scan here:
branch_pattern: coverity_scan
but you said you are pushing to the branch scan_coverity. So you might want to try pushing to coverity_scan instead?
I had trouble too but got it working eventually.
First go to your "Project Settings" in Coverity. Copy the token
Install the travis gem locally.
Then run:
travis encrypt -r <coverity_project_name> COVERITY_SCAN_TOKEN=<token>
For "coverity_project_name", use the name that is shown in your Coverity dashboard exactly as it appears.
You need to put the key generated by 'travis encrypt' into the "secure" field. So you should wind up with something like this:
- os: linux
dist: bionic
compiler: gcc
env:
- secure: "key generated by travis -r"
before_install:
- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
addons:
coverity_scan:
project:
name: "theimpossibleastronaut/rmw"
description: "Console recycle bin written in C"
notification_email:
build_command_prepend: "./configure"
build_command: "make"
branch_pattern: coverity_scan

Resources