gitlab.com/polyapp-open-source/poly@v0.0.0-20200304172929-90b164ae7520/.gitlab-ci.yml (about) 1 # This file is a template, and might need editing before it works on your project. 2 image: golang:latest 3 4 variables: 5 # Please edit to your GitLab project 6 REPO_NAME: gitlab.com/polyapp-open-source/build-wasm 7 8 # The problem is that to be able to use go get, one needs to put 9 # the repository in the $GOPATH. So for example if your gitlab domain 10 # is gitlab.com, and that your repository is namespace/project, and 11 # the default GOPATH being /go, then you'd need to have your 12 # repository in /go/src/gitlab.com/namespace/project 13 # Thus, making a symbolic link corrects this. 14 before_script: 15 - mkdir -p $GOPATH/src/$(dirname $REPO_NAME) 16 - ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME 17 - cd $GOPATH/src/$REPO_NAME 18 19 stages: 20 - test 21 - build 22 - demo 23 24 # https://github.com/golangci/golangci-lint 25 # Your editor probably supports some sort of extension to run this continuously on your repo 26 lint: 27 image: golangci/golangci-lint:latest 28 # lint isn't test, but I don't want to add another full pipeline stage to run it 29 stage: test 30 allow_failure: true 31 script: 32 - golangci-lint run 33 34 test: 35 stage: test 36 script: 37 - CGO_ENABLED=0 go test ./... 38 # Additional targets satisfy issue #4 39 buster_test: 40 image: golang:1-buster 41 stage: test 42 script: 43 - CGO_ENABLED=0 go test ./... 44 windowscore_test: 45 image: golang:1-windowsservercore-1809 46 stage: test 47 tags: 48 - windows 49 before_script: 50 - $Env:GOPATH 51 script: 52 - go test ./... 53 54 build: 55 stage: build 56 script: 57 - CGO_ENABLED=0 go build 58 artifacts: 59 paths: 60 - poly 61 # Additional targets satisfy issue #4 62 buster_build: 63 image: golang:1-buster 64 stage: build 65 script: 66 - CGO_ENABLED=0 go build 67 artifacts: 68 paths: 69 - poly 70 windowscore_build: 71 image: golang:1-windowsservercore-1809 72 tags: 73 - windows 74 stage: build 75 before_script: 76 - $Env:GOPATH 77 script: 78 - go build 79 artifacts: 80 paths: 81 - poly.exe 82 83 poly_demo_lint: 84 image: golangci/golangci-lint:latest 85 stage: demo 86 script: 87 - cd ./testdata 88 - ../poly lint 89 poly_demo_lint_windows: 90 image: golang:1-windowsservercore-1809 91 tags: 92 - windows 93 stage: demo 94 before_script: 95 - $Env:GOPATH 96 script: 97 # Install golangci-lint in PATH 98 - .\installGolangciLint.ps1 99 # When you actually run golangci-lint you'll find you need 'diff' executable. 100 # So install Git in PATH so we can get some of its tooling 101 # But first install chocolatey because unlike golanci-lint it's actually an available package 102 - .\installChoco.ps1 103 - .\installGitWithChoco.ps1 104 # Run lint 105 - cd ./testdata 106 - ../poly.exe lint 107 108 poly_demo_test: 109 stage: demo 110 script: 111 - cd ./testdata 112 - ../poly test 113 poly_demo_test_windows: 114 image: golang:1-windowsservercore-1809 115 tags: 116 - windows 117 stage: demo 118 before_script: 119 - $Env:GOPATH 120 script: 121 - cd ./testdata 122 - ../poly.exe test 123 124 poly_demo_build: 125 stage: demo 126 script: 127 - cd ./testdata 128 - ../poly build 129 poly_demo_build_windows: 130 image: golang:1-windowsservercore-1809 131 tags: 132 - windows 133 stage: demo 134 before_script: 135 - $Env:GOPATH 136 script: 137 - cd ./testdata 138 - ../poly.exe build 139 poly_demo_build_tinygo: 140 image: golang:1.13-buster 141 stage: demo 142 script: 143 # install tinygo 144 - wget https://github.com/tinygo-org/tinygo/releases/download/v0.12.0/tinygo_0.12.0_amd64.deb 145 - dpkg -i tinygo_0.12.0_amd64.deb 146 - export PATH=$PATH:/usr/local/tinygo/bin 147 - export TINYGOROOT=/usr/local/tinygo 148 - tinygo version 149 - cd ./testdata 150 - ../poly build 151 poly_demo_build_tinygo_windows: 152 image: golang:1.13-windowsservercore-1809 #tinygo needs 1.13 right now 153 tags: 154 - windows 155 stage: demo 156 before_script: 157 - $Env:GOPATH 158 script: 159 - ./installTinygo.ps1 160 - cd ./testdata 161 - ../poly.exe build 162 163 poly_demo_run: 164 stage: demo 165 script: 166 - cd ./testdata 167 - ../poly run 168 poly_demo_run_windows: 169 image: golang:1-windowsservercore-1809 170 tags: 171 - windows 172 stage: demo 173 before_script: 174 - $Env:GOPATH 175 script: 176 - cd ./testdata 177 - ../poly.exe run