template / commit
Change how the linter is installed, this simplifies things a lot.
.gitlab-ci.yml | 33 +-------------------------------- Makefile | 2 ++ 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c79ed1..bd71a2b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,4 @@ -# This file is a template, and might need editing before it works on your project. -# This is a sample GitLab CI/CD configuration file that should run without any modifications. -# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts, -# it uses echo commands to simulate the pipeline execution. -# -# A pipeline is composed of independent jobs that run scripts, grouped into stages. -# Stages run in sequential order, but jobs within stages run in parallel. -# -# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages -# -# 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: +# Copied from # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml image: golang:1.19 @@ -26,28 +11,17 @@ stages: # List of stages for jobs, and their order of execution build-job: # This job runs in the build stage, which runs first. stage: build script: - - echo "Compiling the code..." - make build - - echo "Compile complete." unit-test-job: # This job runs in the test stage. stage: test # It only starts when the job in the build stage completes successfully. script: - - echo "Running unit tests... This will take about 60 seconds." - make test - - echo "Code coverage is 90%" lint-test-job: # This job also runs in the test stage. stage: test # It can run at the same time as unit-test-job (in parallel). script: - - echo "Linting code... This will take about 10 seconds." - # - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.50.1 - # - export PATH=$PATH:./bin - - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - - whereis golangci-lint - - golangci-lint --version - make lint - - echo "No lint issues found." release: stage: release @@ -66,11 +40,6 @@ release: - tags script: | - echo "$CI_JOB_STAGE" - echo "$GITLAB_TOKEN" - echo "honestly, wtf is going on?!" - # GITLAB_TOKEN is needed to create GitLab releases. - # DOCKER_* are needed to push Docker images. docker run --rm --privileged \ -v $PWD:/go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \ -w /go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \ diff --git a/Makefile b/Makefile index 3af8591..ede671e 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ build: prep go build . lint: build + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + golangci-lint --version golangci-lint run test: build