# This file is a template, and might need editing before it works on your project. # You can copy and paste this template into a new `.gitlab-ci.yml` file. # You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword. # # To contribute improvements to CI/CD templates, please follow the Development guide at: # https://docs.gitlab.com/ee/development/cicd/templates.html # This specific template is located at: # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Go.gitlab-ci.yml stages: - test - build - release format: image: golang:latest stage: test script: - go fmt $(go list ./... | grep -v /vendor/) - go vet $(go list ./... | grep -v /vendor/) - go test -race $(go list ./... | grep -v /vendor/) compile: image: golang:latest stage: build script: - mkdir -p bin - GOOS=windows GOARCH=386 go build -o bin/pinger-32.exe ./... - GOOS=windows GOARCH=amd64 go build -o bin/pinger-x64.exe ./... - GOOS=linux GOARCH=386 go build -o bin/pinger-linux-x86 ./... - GOOS=linux GOARCH=amd64 go build -o bin/pinger-linux-x64 ./... artifacts: paths: - bin expire_in: 1 week upload: stage: release image: curlimages/curl:latest rules: - if: $CI_COMMIT_TAG script: - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-32.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-32.exe"' - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-x64.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-x64.exe"' - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-linux-x86 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-linux-x86"' - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-linux-x64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-linux-x64"'