mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-01 23:29:12 +01:00
30ce3731a1
* denisenkom/go-mssqldb untagged -> v0.9.0 * github.com/editorconfig/editorconfig-core-go v2.3.7 -> v2.3.8 * github.com/go-testfixtures/testfixtures v3.4.0 -> v3.4.1 * github.com/mholt/archiver v3.3.2 -> v3.5.0 * github.com/olivere/elastic v7.0.20 -> v7.0.21 * github.com/urfave/cli v1.22.4 -> v1.22.5 * github.com/xanzy/go-gitlab v0.38.1 -> v0.39.0 * github.com/yuin/goldmark-meta untagged -> v1.0.0 * github.com/ethantkoenig/rupture 0a76f03a811a -> c3b3b810dc77 * github.com/jaytaylor/html2text 8fb95d837f7d -> 3577fbdbcff7 * github.com/kballard/go-shellquote cd60e84ee657 -> 95032a82bc51 * github.com/msteinert/pam 02ccfbfaf0cc -> 913b8f8cdf8b * github.com/unknwon/paginater 7748a72e0141 -> 042474bd0eae * CI.restart() Co-authored-by: techknowlogick <techknowlogick@gitea.io>
111 lines
3.3 KiB
YAML
Vendored
111 lines
3.3 KiB
YAML
Vendored
trigger:
|
|
- master
|
|
|
|
strategy:
|
|
matrix:
|
|
linux:
|
|
imageName: ubuntu-18.04
|
|
gorootDir: /usr/local
|
|
mac:
|
|
# Mojave
|
|
imageName: macos-10.14
|
|
gorootDir: /usr/local
|
|
windows:
|
|
imageName: windows-2019
|
|
gorootDir: C:\
|
|
|
|
pool:
|
|
vmImage: $(imageName)
|
|
|
|
variables:
|
|
GOROOT: $(gorootDir)/go
|
|
GOPATH: $(system.defaultWorkingDirectory)/gopath
|
|
GOBIN: $(GOPATH)/bin
|
|
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)'
|
|
# TODO: Enable modules after upstream dependency zstd supports them
|
|
# TODO: modules should be the default in Go 1.13, so this won't be needed
|
|
#GO111MODULE: on
|
|
|
|
steps:
|
|
|
|
- bash: git config --global core.autocrlf false
|
|
displayName: "Disable line ending conversion for git to"
|
|
|
|
- checkout: self
|
|
|
|
- bash: |
|
|
latestGo=$(curl "https://golang.org/VERSION?m=text")
|
|
echo "##vso[task.setvariable variable=LATEST_GO]$latestGo"
|
|
echo "Latest Go version: $latestGo"
|
|
displayName: "Get latest Go version"
|
|
|
|
- bash: |
|
|
sudo rm -f $(which go)
|
|
echo '##vso[task.prependpath]$(GOBIN)'
|
|
echo '##vso[task.prependpath]$(GOROOT)/bin'
|
|
mkdir -p '$(modulePath)'
|
|
shopt -s extglob
|
|
shopt -s dotglob
|
|
mv !(gopath) '$(modulePath)'
|
|
displayName: Remove old Go, set GOBIN/GOROOT, and move project into GOPATH
|
|
|
|
# Install Go (this varies by platform)
|
|
|
|
- bash: |
|
|
wget "https://dl.google.com/go/$(LATEST_GO).linux-amd64.tar.gz"
|
|
sudo tar -C $(gorootDir) -xzf "$(LATEST_GO).linux-amd64.tar.gz"
|
|
condition: eq( variables['Agent.OS'], 'Linux' )
|
|
displayName: Install Go on Linux
|
|
|
|
- bash: |
|
|
wget "https://dl.google.com/go/$(LATEST_GO).darwin-amd64.tar.gz"
|
|
sudo tar -C $(gorootDir) -xzf "$(LATEST_GO).darwin-amd64.tar.gz"
|
|
condition: eq( variables['Agent.OS'], 'Darwin' )
|
|
displayName: Install Go on macOS
|
|
|
|
- powershell: |
|
|
echo "Downloading Go..."
|
|
# Windows comes with BSD curl, which is MUCH faster than the native Windows HTTP
|
|
curl.exe -fsSL -o "$(LATEST_GO).windows-amd64.zip" "https://dl.google.com/go/$(LATEST_GO).windows-amd64.zip"
|
|
echo "Extracting Go..."
|
|
# Yes, Windows tar (BSD tar) handles zip files. Who knew!?
|
|
# (and it's MUCH, MUCH, MUCH faster than the native Windows expander)
|
|
tar.exe xf "$(LATEST_GO).windows-amd64.zip" -C "$(gorootDir)"
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
displayName: Install Go on Windows
|
|
|
|
- bash: |
|
|
printf "Using go at: $(which go)\n"
|
|
printf "Go version: $(go version)\n"
|
|
printf "\n\nGo environment:\n\n"
|
|
go env
|
|
printf "\n\nSystem environment:\n\n"
|
|
env
|
|
displayName: Print Go version and environment
|
|
|
|
- script: |
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.31.0
|
|
./bin/golangci-lint run -E gofmt -E goimports -E misspell ./...
|
|
workingDirectory: '$(modulePath)'
|
|
condition: eq( variables['Agent.OS'], 'Linux' )
|
|
displayName: Run Lint
|
|
|
|
- bash: |
|
|
go mod tidy
|
|
if [ ! -z "$(git status --porcelain go.mod)" ]; then
|
|
printf "go.mod has modifications\n"
|
|
git diff go.mod
|
|
exit 1
|
|
fi
|
|
if [ ! -z "$(git status --porcelain go.sum)" ]; then
|
|
printf "go.sum has modifications\n"
|
|
git diff go.sum
|
|
exit 1
|
|
fi
|
|
workingDirectory: '$(modulePath)'
|
|
displayName: Ensure that module definition and checksums are correct
|
|
|
|
- script: |
|
|
go test -race ./...
|
|
workingDirectory: '$(modulePath)'
|
|
displayName: Run tests
|