Skip to content

fix: allow CI to download modules #7

fix: allow CI to download modules

fix: allow CI to download modules #7

Workflow file for this run

on:
push:
branches:
- main
pull_request:
name: run tests
jobs:
test:
runs-on: ubuntu-latest
env:
GO_VERSION: "1.21"
GOPRIVATE: gitlab.com/nitrado/*
GOLANGCI_LINT_VERSION: v1.54.2
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
- uses: extractions/netrc@v1
with:
machine: gitlab.com
username: ${{ secrets.GITLAB_USERNAME }}
password: ${{ secrets.GITLAB_TOKEN }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download Go modules
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
ls -l ~/.netrc
cat ~/.netrc
git config --global url."https://api:${GITLAB_TOKEN}@gitlab.com".insteadOf "https://github.com"
go mod download
- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --go ${{ env.GO_VERSION }}
- name: Run tests
run: go test -race ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --snapshot