From fb3ca08274f3f78a312208d6940dc6c1a448256e Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 3 May 2022 15:00:17 +0100 Subject: [PATCH] add build workflow --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++ dcrlibwallet-ci-build.sh | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100755 dcrlibwallet-ci-build.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4cb8e1be --- /dev/null +++ b/.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 diff --git a/dcrlibwallet-ci-build.sh b/dcrlibwallet-ci-build.sh new file mode 100755 index 00000000..97190166 --- /dev/null +++ b/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