autobindings/.drone.yml

171 lines
4.3 KiB
YAML

---
kind: pipeline
type: docker
name: linux-android-windows-test
steps:
- name: fetch
image: openpriv/go-cross-compile:2024.02
volumes:
- name: deps
path: /go
commands:
- go install honnef.co/go/tools/cmd/staticcheck@latest
- go install go.uber.org/nilaway/cmd/nilaway@latest
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.8.9-linux-x86_64.tar.gz -O tor.tar.gz
- tar -xzf tor.tar.gz
- chmod a+x Tor/tor
- export PATH=$PWD/Tor/:$PATH
- export LD_LIBRARY_PATH=$PWD/Tor/
- tor --version
- export GO111MODULE=on
- git fetch --tags
- go mod download
- echo `git describe --tags` > VERSION
- echo `git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M` > COMMIT_DATE
- export GOSUMDB="off"
- name: build-linux
image: openpriv/go-cross-compile:2024.02
volumes:
- name: deps
path: /go
commands:
- make clean
# Compile Server Experiments
- make linux
- name: build-android
image: openpriv/go-cross-compile:2024.02
volumes:
- name: deps
path: /go
commands:
# Build Android without Server Experiment
- make clean-autobindings
- env EXPERIMENTS="" make lib.go
- go mod download
- gomobile init
- make android
- name: build-windows
image: openpriv/go-cross-compile:2024.02
environment:
GOPATH: /go
volumes:
- name: deps
path: /go
commands:
- make clean-autobindings
- make windows
- name: deploy-buildfiles
image: openpriv/go-cross-compile:2024.02
pull: if-not-exists
environment:
BUILDFILES_KEY:
from_secret: buildfiles_key
secrets: [gogs_account_token]
when:
event:
- push
- tag
status: [ success ]
commands:
- echo $BUILDFILES_KEY > ~/id_rsab64
- base64 -d ~/id_rsab64 > ~/id_rsa
- chmod 400 ~/id_rsa
- export DIR=libCwtch-autobindings-`cat COMMIT_DATE`-`cat VERSION`
- mkdir -p $DIR
- mv build/* $DIR/
- cd $DIR
- find . -type f -exec sha512sum {} \; > ./../sha512sum.txt
- mv ./../sha512sum.txt .
- cd ..
- scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/
- name: notify-gogs
image: openpriv/drone-gogs
pull: if-not-exists
when:
event: pull_request
status: [ success, changed, failure ]
environment:
GOGS_ACCOUNT_TOKEN:
from_secret: gogs_account_token
settings:
gogs_url: https://git.openprivacy.ca
volumes:
# gopath where bin and pkg lives to persist across steps
- name: deps
temp: {}
trigger:
repo: cwtch.im/autobindings
branch: main
event:
- push
- pull_request
- tag
---
kind: pipeline
type: exec
name: macos
platform:
os: darwin
arch: amd64
steps:
- name: fetch
commands:
- export PATH=$PATH:/usr/local/go/bin/
- git fetch --tags
- echo `git describe --tags` > VERSION
- echo `git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M` > COMMIT_DATE
- name: build-macos-x64
commands:
- export PATH=$PATH:/usr/local/go/bin/
- env EXPERIMENTS="serverExperiment" make lib.go
- make libCwtch.x64.dylib
- name: build-macos-arm64
when:
event:
- push
status: [ success ]
commands:
- export PATH=$PATH:/usr/local/go/bin/
- make clean-autobindings
- env EXPERIMENTS="serverExperiment" make lib.go
- go mod download
- make libCwtch.arm64.dylib
- name: deploy-buildfiles
environment:
BUILDFILES_KEY:
from_secret: buildfiles_key
when:
event:
- push
status: [ success ]
commands:
- echo $BUILDFILES_KEY > ~/id_rsab64
- base64 -d -i ~/id_rsab64 -o ~/id_rsa
- chmod 400 ~/id_rsa
- export DIR=libCwtch-autobindings-`cat COMMIT_DATE`-`cat VERSION`
- mkdir -p $DIR
- mv build/* $DIR/
- cd $DIR
- find . -type f -exec shasum -a 512 {} \; > ./../macsha512s.txt
- mv ./../macsha512s.txt .
- cd ..
- scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/
trigger:
repo: cwtch.im/autobindings
branch: main
event:
- push
- pull_request