[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Refactor android script to be in android job



commit c1fa4efe4b6e289758224a5a4c8bcaa3d7067449
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date:   Wed Jul 8 10:49:41 2020 -0400

    Refactor android script to be in android job
---
 .gitlab-ci.yml | 79 +++++++++++++++++++++++++++++++---------------------------
 1 file changed, 42 insertions(+), 37 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 18902e6..04a58fc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,6 +41,15 @@
         git
         lbzip2
 
+.go_test: &go-test
+  - test -z "$(go fmt ./...)"
+  - go vet ./...
+  - go test -v -race ./...
+
+  - cd $CI_PROJECT_DIR/client/
+  - go get
+  - go build
+
 .test-template: &test-template
   artifacts:
     name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
@@ -52,17 +61,35 @@
     when: on_success
   after_script:
     - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs";
-  script:
-    - test -z "$(go fmt ./...)"
-    - go vet ./...
-    - go test -v -race ./...
 
-    - cd $CI_PROJECT_DIR/client/
-    - go get
-    - go build
+# -- jobs ------------------------------------------------------------
 
-    # build for Android if this is the right job
-    - test "$CI_JOB_NAME" = "android" || exit 0
+android:
+  image: registry.gitlab.com/fdroid/ci-images-client
+  variables:
+    GOPATH: "/go"
+  cache:
+    paths:
+      - .gradle/wrapper
+      - .gradle/caches
+  before_script:
+    - apt-get -qy update
+    - apt-get -qy install --no-install-recommends
+        build-essential
+        gnupg
+        wget
+    - cd /usr/local
+    - export gotarball="go1.13.12.linux-amd64.tar.gz"
+    - wget -q https://dl.google.com/go/${gotarball}
+    - wget -q https://dl.google.com/go/${gotarball}.asc
+    - curl https://dl.google.com/linux/linux_signing_key.pub | gpg --import
+    - gpg --verify ${gotarball}.asc
+    - echo "9cacc6653563771b458c13056265aa0c21b8a23ca9408278484e4efde4160618  ${gotarball}" | sha256sum -c
+    - tar -xzf ${gotarball}
+    - export PATH="/usr/local/go/bin:$GOPATH/bin:$PATH"  # putting this in 'variables:' cause weird runner errors
+    - cd $CI_PROJECT_DIR
+  script:
+    - *go-test
     - export GRADLE_USER_HOME=$PWD/.gradle
     # This build was setup before go.mod was a thing, go back to the old days!
     # 920f6791f3ec8e7467c43ee0cefffe63200bed2b broke the gomobile build.
@@ -93,47 +120,25 @@
     # gomobile builds a shared library not a CLI executable
     - sed -i 's,^package main$,package snowflakeclient,' snowflake.go client_test.go
     - gomobile bind -v -target=android git.torproject.org/pluggable-transports/snowflake/client
-
-
-# -- jobs ------------------------------------------------------------
-
-android:
-  image: registry.gitlab.com/fdroid/ci-images-client
-  variables:
-    GOPATH: "/go"
-  cache:
-    paths:
-      - .gradle/wrapper
-      - .gradle/caches
-  before_script:
-    - apt-get -qy update
-    - apt-get -qy install --no-install-recommends
-        build-essential
-        gnupg
-        wget
-    - cd /usr/local
-    - export gotarball="go1.13.12.linux-amd64.tar.gz"
-    - wget -q https://dl.google.com/go/${gotarball}
-    - wget -q https://dl.google.com/go/${gotarball}.asc
-    - curl https://dl.google.com/linux/linux_signing_key.pub | gpg --import
-    - gpg --verify ${gotarball}.asc
-    - echo "9cacc6653563771b458c13056265aa0c21b8a23ca9408278484e4efde4160618  ${gotarball}" | sha256sum -c
-    - tar -xzf ${gotarball}
-    - export PATH="/usr/local/go/bin:$GOPATH/bin:$PATH"  # putting this in 'variables:' cause weird runner errors
-    - cd $CI_PROJECT_DIR
   <<: *test-template
 
 go-1.13:
   image: golang:1.13-stretch
   <<: *golang-docker-debian-template
   <<: *test-template
+  script:
+    - *go-test
 
 go-1.14:
   image: golang:1.14-stretch
   <<: *golang-docker-debian-template
   <<: *test-template
+  script:
+    - *go-test
 
 debian-testing:
   image: debian:testing
   <<: *debian-native-template
   <<: *test-template
+  script:
+    - *go-test



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits