forked from danielpaulus/go-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces a nice ci workflow that allows to attach a personal device easily to the CI so tests can be run on different OS'es with local devices. Also shows how to use app-signer to dynamically sign an ipa using a github actions cloud mac.
- Loading branch information
1 parent
8d671c0
commit 01a4537
Showing
3 changed files
with
129 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ngrok: | ||
description: 'ngrok host:port' | ||
required: true | ||
default: '' | ||
udid: | ||
description: 'device udid' | ||
required: true | ||
default: '' | ||
# run this locally to get a device exposed on ngrok | ||
# ngrok tcp 9999 | ||
# socat TCP-LISTEN:9999,reuseaddr,fork UNIX-CONNECT:/var/run/usbmuxd | ||
name: CI Real Device Test | ||
jobs: | ||
sign_app_on_mac: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: create profile | ||
run: | | ||
echo $P12_FILE | base64 --decode > testdata/test1.p12 | ||
echo $PROFILE | base64 --decode > testdata/test1.mobileprovision | ||
shell: bash | ||
env: | ||
P12_FILE: ${{secrets.P12}} | ||
PROFILE: ${{secrets.PROFILE}} | ||
- name: Run App Signer | ||
run: | | ||
testdata/app-signer-mac --udid=$UDID --p12password=$P12_PW --profilespath=testdata --ipa=testdata/wda.ipa --output=testdata/wda-signed.ipa | ||
env: | ||
P12_PW: ${{secrets.P12PASSWORD}} | ||
UDID: ${{ github.event.inputs.udid }} | ||
- name: delete profiles | ||
if: always() | ||
run: | | ||
rm testdata/test1* | ||
- name: upload the macos build | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: signed-wda | ||
path: testdata/wda-signed.ipa | ||
retention-days: 1 | ||
test_on_windows: | ||
runs-on: windows-latest | ||
needs: sign_app_on_mac | ||
env: | ||
UDID: ${{ github.event.inputs.udid }} | ||
steps: | ||
- uses: actions/cache@v2 # https://github.com/actions/cache/blob/main/examples.md#go---modules | ||
with: | ||
path: | | ||
%LocalAppData%\go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17.x | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: compile | ||
run: go build | ||
- name: Download mac signed wda from previous job | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: signed-wda | ||
- name: extract ipa #github auto zips artifacts after a workflow is complete so we need to unzip the ipa | ||
#as it is now double zipped | ||
run: Expand-Archive -Force wda-signed.ipa testdata/signed-wda.ipa | ||
- name: forward ngrok | ||
run: netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=27015 connectaddress=$($env:NGROK_URL.Split(":")[0]) connectport=$($env:NGROK_URL.Split(":")[1]) | ||
env: | ||
NGROK_URL: ${{ github.event.inputs.ngrok }} | ||
- name: test list | ||
run: go run main.go list | ||
- name: install relative | ||
run: go run main.go install --path testdata\signed-wda.ipa --udid=$($env:UDID) | ||
- name: install absolute | ||
run: go run main.go install --path $PWD\testdata\signed-wda.ipa --udid=$($env:UDID) | ||
|
||
test_on_linux: | ||
runs-on: ubuntu-latest | ||
env: | ||
UDID: ${{ github.event.inputs.udid }} | ||
needs: | ||
- sign_app_on_mac | ||
- test_on_windows | ||
steps: | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17.x | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Download mac release from previous job | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: signed-wda | ||
- name: extract | ||
run: | | ||
mv wda-signed.ipa testdata/signed-wda.ipa | ||
- name: compile | ||
run: go build | ||
- name: install socat | ||
run: sudo apt install socat | ||
- name: ngrok | ||
run: sudo socat UNIX-LISTEN:/var/run/usbmuxd,fork,mode=777 TCP-CONNECT:$NGROK_URL& | ||
env: | ||
NGROK_URL: ${{ github.event.inputs.ngrok }} | ||
- name: test list | ||
run: go run main.go list | ||
- name: install relative | ||
run: go run main.go install --path testdata/signed-wda.ipa --udid=$UDID | ||
|
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
Binary file not shown.