Skip to content

Commit

Permalink
add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dreacot committed May 3, 2022
1 parent 2ce13c3 commit 8dfac95
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,41 @@
name: Build and Test
on: [push, pull_request]

jobs:
testing:
name: Build and Test
runs-on: macOS-latest
steps:
- name: Clone Repo
uses: actions/checkout@v1

- name: Set up XCode 13.0
run: sudo xcode-select -switch /Applications/Xcode_13.0.app

- name: Set up Go 1.16.7
uses: actions/setup-go@v1
with:
go-version: 1.16.7

- name: Cache (CocoaPod & Go Mod)
uses: actions/cache@v2
id: cache
with:
path: |
Pods
~/go/pkg/mod
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: CocoaPod Install
run: pod install

- name: Build Dcrlibwallet
run: ./dcrlibwallet-ci-build.sh

- name: Build Dcrios
run: xcodebuild -workspace Decred\ Wallet.xcworkspace -scheme Decred\ Wallet\ Testnet -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' clean

# - name: Test Dcrios
# run: xcodebuild -workspace Decred\ Wallet.xcworkspace -scheme Decred\ Wallet\ Testnet -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' clean test
48 changes: 48 additions & 0 deletions dcrlibwallet-ci-build.sh
@@ -0,0 +1,48 @@
installGo(){
echo "Installing golang"
curl -O https://storage.googleapis.com/golang/go1.16.7.darwin-amd64.tar.gz
sha256sum go1.16.7.darwin-amd64.tar.gz
tar -xvf go1.16.7.darwin-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
}

installGobind(){
echo "Installing gobind"
export GO111MODULE=off
go get -u golang.org/x/mobile/cmd/gobind
}

installGomobile(){
echo "Installing gomobile"
export GO111MODULE=off
go get -u golang.org/x/mobile/cmd/gomobile
gomobile init
}

if !(hash go 2>/dev/null); then
installGo
fi

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

if !(hash gobind 2>/dev/null); then
installGobind
fi

if !(hash gomobile 2>/dev/null); then
installGomobile
fi


go version
echo "Building dcrlibwallet"
export DcriosDir=$(pwd)
mkdir -p $GOPATH/src/github.com/planetdecred
git clone https://github.com/planetdecred/dcrlibwallet $GOPATH/src/github.com/planetdecred/dcrlibwallet
cd $GOPATH/src/github.com/planetdecred/dcrlibwallet
export GO111MODULE=on && go mod vendor && export GO111MODULE=off
gomobile bind -target=ios
mkdir $DcriosDir/libs
rsync -a Dcrlibwallet.xcframework/ $DcriosDir/libs/Dcrlibwallet.xcframework/ && cd $DcriosDir

0 comments on commit 8dfac95

Please sign in to comment.