diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..43d416e --- /dev/null +++ b/.drone.yml @@ -0,0 +1,177 @@ +--- +kind: pipeline +type: docker +name: linux-android-windows-test + +steps: + - name: fetch + image: golang:1.19.1 + volumes: + - name: deps + path: /go + commands: + - go install honnef.co/go/tools/cmd/staticcheck@latest + - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor + - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc + - chmod a+x tor + - git fetch --tags + - go mod download + - echo `git describe --tags` > VERSION + + - name: build-linux + image: golang:1.19.1 + volumes: + - name: deps + path: /go + commands: + - go run generate/generate_bindings.go -- serverExperiment + - make linux + + - name: build-android + image: openpriv/android-go-mobile:2023.02 + volumes: + - name: deps + path: /go + commands: + - go run generate/generate_bindings.go -- serverExperiment + - go mod download + - gomobile init + - make android + + - name: build-windows + image: openpriv/mingw-go:2023.01 + environment: + GOPATH: /go + volumes: + - name: deps + path: /go + commands: + - go run generate/generate_bindings.go -- serverExperiment + - make windows + + - name: deploy-buildfiles + image: kroniak/ssh-client + 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-go-`cat BUILDDATE`-`cat VERSION` + - mkdir $DIR + - mv libCwtch.so libCwtch.dll cwtch.aar cwtch-sources.jar libCwtch.h $DIR/ + - cd $DIR + - find . -type f -exec sha256sum {} \; > ./../sha256s.txt + - mv ./../sha256s.txt . + - cd .. + - scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/ + + - name: gitea-release + image: plugins/gitea-release + pull: if-not-exists + when: + event: tag + settings: + api_key: + from_secret: gogs_account_token + base_url: https://git.openprivacy.ca + files: + - libCwtch.so + - libCwtch.dll + - cwtch.aar + - cwtch-sources.jar + - libCwtch.h + checksum: + - sha256 + - sha512 + + - 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/libcwtch-go + branch: trunk + 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 + - name: build-macos-x64 + commands: + - export PATH=$PATH:/usr/local/go/bin/ + - make libCwtch.x64.dylib + - name: build-macos-arm64 + when: + event: + - push + status: [ success ] + commands: + - export PATH=$PATH:/usr/local/go/bin/ + - go run generate/generate_bindings.go -- serverExperiment + - 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 ~/id_rsab64 > ~/id_rsa + - chmod 400 ~/id_rsa + - export DIR=libCwtch-go-macos-`cat BUILDDATE`-`cat VERSION` + - mkdir $DIR + - mv libCwtch.x64.dylib $DIR/ + - mv libCwtch.arm64.dylib $DIR/ + - cd $DIR + - find . -type f -exec shasum -a 512 {} \; > ./../sha512s.txt + - mv ./../sha512s.txt . + - cd .. + - scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/ + +trigger: + repo: cwtch.im/libcwtch-go + branch: trunk + event: + - push + - pull_request \ No newline at end of file diff --git a/generate/generate_bindings.go b/generate/generate_bindings.go index f486558..2bdc85c 100644 --- a/generate/generate_bindings.go +++ b/generate/generate_bindings.go @@ -1,6 +1,5 @@ package main -import "C" import ( "bufio" "fmt"