From f0870e4407737ff000ba1e93ecbfb29c3e6de3c8 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 12:35:55 -0700 Subject: [PATCH 1/5] drone pipeline file test --- .drone.yml | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..419c14b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,63 @@ +--- +kind: pipeline +type: docker +name: default + +steps: + - name: fetch + image: golang + when: + repo: flutter/libcwtch-go + branch: trunk + event: [ push, pull_request ] + commands: + - 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 + - go get -u golang.org/x/lint/golint + - go mod vendor + quality: + image: golang + when: + repo: flutter/libcwtch-go + branch: trunk + event: [ push, pull_request ] + commands: + - go list ./... | xargs go vet + - go list ./... | xargs golint -set_exit_status + build-linux: + image: openpriv/android-go-mobile:2021 + when: + repo: flutter/libcwtch-go + branch: trunk + event: [ push, pull_request ] + commands: + - make linux + build-androiud: + image: openpriv/android-go-mobile:2021 + when: + repo: flutter/libcwtch-go + branch: trunk + event: [ push, pull_request ] + commands: + - make android + notify-email: + image: drillster/drone-email + host: build.openprivacy.ca + port: 25 + skip_verify: true + from: drone@openprivacy.ca + when: + repo: flutter/libcwtch-go + branch: trunk + event: [ push, pull_request ] + status: [ failure ] + notify-gogs: + image: openpriv/drone-gogs + when: + repo: flutter/libcwtch-go + branch: trunk + event: pull_request + status: [ success, changed, failure ] + secrets: [gogs_account_token] + gogs_url: https://git.openprivacy.ca \ No newline at end of file From 94792c595390a7854ae052ce529eb4bf6819bc01 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 12:47:03 -0700 Subject: [PATCH 2/5] .drone.yml syntax fix --- .drone.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1abeb82..fbe3b7f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,18 +27,18 @@ steps: - go list ./... | xargs golint -set_exit_status - name: buildLinux image: openpriv/android-go-mobile:2021 - when: - repo: flutter/libcwtch-go - branch: trunk - event: [ push, pull_request ] - commands: - - make linux + when: + repo: flutter/libcwtch-go + branch: trunk + event: [ push, pull_request ] + commands: + - make linux - name: build-androiud image: openpriv/android-go-mobile:2021 - when: - repo: flutter/libcwtch-go - branch: trunk - event: [ push, pull_request ] + when: + repo: flutter/libcwtch-go + branch: trunk + event: [ push, pull_request ] commands: - make android - name: notify-email From 68e60d438d3a57b1de5542b54ac582de98e7b788 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 13:16:27 -0700 Subject: [PATCH 3/5] fix govet 'error' and disable .drone.yml quality linting --- .drone.yml | 8 ++++---- lib.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index fbe3b7f..a80113f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,8 +14,7 @@ steps: - 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 - - go get -u golang.org/x/lint/golint - - go mod vendor + - go install golang.org/x/lint/golint - name: quality image: golang when: @@ -24,7 +23,8 @@ steps: event: [ push, pull_request ] commands: - go list ./... | xargs go vet - - go list ./... | xargs golint -set_exit_status + - go list ./... | xargs golint + #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting - name: buildLinux image: openpriv/android-go-mobile:2021 when: @@ -60,4 +60,4 @@ steps: event: pull_request status: [ success, changed, failure ] secrets: [gogs_account_token] - gogs_url: https://git.openprivacy.ca \ No newline at end of file + gogs_url: https://git.openprivacy.ca diff --git a/lib.go b/lib.go index 2aab010..47b1d4e 100644 --- a/lib.go +++ b/lib.go @@ -59,7 +59,7 @@ func StartCwtch(appDir string, torPath string) { log.Infof("making directory %v", appDir) os.MkdirAll(path.Join(appDir, "/.tor", "tor"), 0700) tor.NewTorrc().WithSocksPort(port).WithOnionTrafficOnly().WithControlPort(controlPort).WithHashedPassword(base64.StdEncoding.EncodeToString(key)).Build(filepath.Join(appDir, ".tor", "tor", "torrc")) - acn, err := tor.NewTorACNWithAuth(path.Join(appDir, "/.tor"), torPath, controlPort, tor.HashedPasswordAuthenticator{base64.StdEncoding.EncodeToString(key)}) + acn, err := tor.NewTorACNWithAuth(path.Join(appDir, "/.tor"), torPath, controlPort, tor.HashedPasswordAuthenticator{Password: base64.StdEncoding.EncodeToString(key)}) if err != nil { log.Errorf("\nError connecting to Tor: %v\n", err) } From d53d81f8d0df4a1c8b143a21a12e5ad2d6029797 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 13:22:02 -0700 Subject: [PATCH 4/5] .drone.yml go get golint... not go1.16 yet --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index a80113f..7ecc2f0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,7 +14,8 @@ steps: - 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 - - go install golang.org/x/lint/golint + - go get -u golang.org/x/lint/golint + # go install for 1.16 - name: quality image: golang when: From e9b6e10795900a5b99d391fb6fd164a95a780bbb Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 13:31:16 -0700 Subject: [PATCH 5/5] drone.yml keep vendors --- .drone.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7ecc2f0..5022550 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,6 +6,9 @@ name: default steps: - name: fetch image: golang + volumes: + - name: deps + path: /go when: repo: flutter/libcwtch-go branch: trunk @@ -15,9 +18,16 @@ steps: - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor - go get -u golang.org/x/lint/golint - # go install for 1.16 + #- export GO111MODULE=on + #- go mod vendor + - go get + # TODO: upgrade to go1.16, remove mod/vendor, add go install for 1.16 + # go vendor so packages aren't refetched each new stage which loses this working dir, or restructure workspace to include pkg - name: quality image: golang + volumes: + - name: deps + path: /go when: repo: flutter/libcwtch-go branch: trunk @@ -26,16 +36,22 @@ steps: - go list ./... | xargs go vet - go list ./... | xargs golint #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting - - name: buildLinux + - name: build-linux image: openpriv/android-go-mobile:2021 + volumes: + - name: deps + path: /go when: repo: flutter/libcwtch-go branch: trunk event: [ push, pull_request ] commands: - make linux - - name: build-androiud + - name: build-android image: openpriv/android-go-mobile:2021 + volumes: + - name: deps + path: /go when: repo: flutter/libcwtch-go branch: trunk @@ -62,3 +78,7 @@ steps: status: [ success, changed, failure ] secrets: [gogs_account_token] gogs_url: https://git.openprivacy.ca + +volumes: + - name: deps + temp: {}