@marcel91200 / caddy Mirror · read-only / commits / 1ecb2160
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

v2: introduce CI (#2768)

* v2: introduce CI for v2 branch * v2-ci: split test report generation from test pass to preserve exit code * v2-ci: spilt lint results from unit test results * v2-ci: fix testRunTitle name * v2-ci: break up the steps for more accurate status indicators * v2-ci: break steps into different jobs * v2-ci: revert back to single-job pattern * v2-ci: reflect the true result by coercing SucceededWithIssues into Failed in the last step * v2-ci: don't fail the build on lint errors

Mohammed Al Sahaf committed Oct 2, 2019 at 01:47 UTC 1ecb216001f77127084fc9bf5c075acebfec58a9
2 files changed +144
README.md
+2
@@ -1,6 +1,8 @@
1 Caddy 2 Development Branch
2 ===========================
3
4 +[![Build Status](https://dev.azure.com/mholt-dev/Caddy/_apis/build/status/Multiplatform%20Tests?branchName=v2)](https://dev.azure.com/mholt-dev/Caddy/_build/latest?definitionId=5&branchName=v2)
5 +
6 This is the development branch for Caddy 2. This code (version 2) is not yet feature-complete or production-ready, but is already being used in production, and we encourage you to deploy it today on sites that are not very visible or important so that it can obtain crucial experience in the field.
7
8 Please file issues to propose new features and report bugs, and after the bug or feature has been discussed, submit a pull request! We need your help to build this web server into what you want it to be. (Caddy 2 issues and pull requests will usually receive priority over Caddy 1 issues and pull requests.)
azure-pipelines.yml new
+142
@@ -0,0 +1,142 @@
1 +# Mutilated beyond recognition from the example at:
2 +# https://docs.microsoft.com/azure/devops/pipelines/languages/go
3 +
4 +trigger:
5 +- v2
6 +
7 +strategy:
8 + matrix:
9 + linux:
10 + imageName: ubuntu-16.04
11 + gorootDir: /usr/local
12 + mac:
13 + imageName: macos-10.13
14 + gorootDir: /usr/local
15 + windows:
16 + imageName: windows-2019
17 + gorootDir: C:\
18 +pool:
19 + vmImage: $(imageName)
20 +
21 +variables:
22 + GOROOT: $(gorootDir)/go
23 + GOPATH: $(system.defaultWorkingDirectory)/gopath
24 + GOBIN: $(GOPATH)/bin
25 + modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)'
26 + # TODO: Remove once it's enabled by default
27 + GO111MODULE: on
28 +
29 +steps:
30 +- bash: |
31 + latestGo=$(curl "https://golang.org/VERSION?m=text")
32 + echo "##vso[task.setvariable variable=LATEST_GO]$latestGo"
33 + echo "Latest Go version: $latestGo"
34 + displayName: "Get latest Go version"
35 +
36 +- bash: |
37 + sudo rm -f $(which go)
38 + echo '##vso[task.prependpath]$(GOBIN)'
39 + echo '##vso[task.prependpath]$(GOROOT)/bin'
40 + mkdir -p '$(modulePath)'
41 + shopt -s extglob
42 + shopt -s dotglob
43 + mv !(gopath) '$(modulePath)'
44 + displayName: Remove old Go, set GOBIN/GOROOT, and move project into GOPATH
45 +
46 +# Install Go (this varies by platform)
47 +- bash: |
48 + wget "https://dl.google.com/go/$(LATEST_GO).linux-amd64.tar.gz"
49 + sudo tar -C $(gorootDir) -xzf "$(LATEST_GO).linux-amd64.tar.gz"
50 + condition: eq( variables['Agent.OS'], 'Linux' )
51 + displayName: Install Go on Linux
52 +
53 +- bash: |
54 + wget "https://dl.google.com/go/$(LATEST_GO).darwin-amd64.tar.gz"
55 + sudo tar -C $(gorootDir) -xzf "$(LATEST_GO).darwin-amd64.tar.gz"
56 + condition: eq( variables['Agent.OS'], 'Darwin' )
57 + displayName: Install Go on macOS
58 +
59 +- powershell: |
60 + Write-Host "Downloading Go... (please be patient, I am very slow)"
61 + (New-Object System.Net.WebClient).DownloadFile("https://dl.google.com/go/$(LATEST_GO).windows-amd64.zip", "$(LATEST_GO).windows-amd64.zip")
62 + Write-Host "Extracting Go... (I'm slow too)"
63 + Expand-Archive "$(LATEST_GO).windows-amd64.zip" -DestinationPath "$(gorootDir)"
64 + condition: eq( variables['Agent.OS'], 'Windows_NT' )
65 + displayName: Install Go on Windows
66 +
67 +- bash: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.19.1
68 + displayName: Install golangci-lint
69 +
70 +- script: |
71 + go get github.com/axw/gocov/gocov
72 + go get github.com/AlekSi/gocov-xml
73 + go get -u github.com/jstemmer/go-junit-report
74 + displayName: Install test and coverage analysis tools
75 +
76 +- bash: |
77 + printf "Using go at: $(which go)\n"
78 + printf "Go version: $(go version)\n"
79 + printf "\n\nGo environment:\n\n"
80 + go env
81 + printf "\n\nSystem environment:\n\n"
82 + env
83 + displayName: Print Go version and environment
84 +
85 +- script: |
86 + go get -v -t -d ./...
87 + mkdir test-results
88 + workingDirectory: '$(modulePath)'
89 + displayName: Get dependencies
90 +
91 +- script: |
92 + (golangci-lint run --out-format junit-xml -E gofmt -E goimports -E misspell) > test-results/lint-result.xml
93 + exit 0
94 + workingDirectory: '$(modulePath)'
95 + continueOnError: true
96 + displayName: Run lint check
97 +
98 +- script: |
99 + (go test -v -coverprofile=cover-profile.out -race ./... 2>&1) > test-results/test-result.out
100 + workingDirectory: '$(modulePath)'
101 + continueOnError: true
102 + displayName: Run tests
103 +
104 +- script: |
105 + mkdir coverage
106 + gocov convert cover-profile.out > coverage/coverage.json
107 + # Because Windows doesn't work with input redirection like *nix, but output redirection works.
108 + (cat ./coverage/coverage.json | gocov-xml) > coverage/coverage.xml
109 + workingDirectory: '$(modulePath)'
110 + displayName: Prepare coverage reports
111 +
112 +- script: |
113 + (cat ./test-results/test-result.out | go-junit-report) > test-results/test-result.xml
114 + workingDirectory: '$(modulePath)'
115 + displayName: Prepare test report
116 +
117 +- task: PublishCodeCoverageResults@1
118 + displayName: Publish test coverage report
119 + inputs:
120 + codeCoverageTool: Cobertura
121 + summaryFileLocation: $(modulePath)/coverage/coverage.xml
122 +
123 +- task: PublishTestResults@2
124 + displayName: Publish unit test
125 + inputs:
126 + testResultsFormat: 'JUnit'
127 + testResultsFiles: $(modulePath)/test-results/test-result.xml
128 + testRunTitle: $(agent.OS) Unit Test
129 + mergeTestResults: false
130 +
131 +- task: PublishTestResults@2
132 + displayName: Publish lint results
133 + inputs:
134 + testResultsFormat: 'JUnit'
135 + testResultsFiles: $(modulePath)/test-results/lint-result.xml
136 + testRunTitle: $(agent.OS) Lint
137 + mergeTestResults: false
138 +
139 +- bash: |
140 + exit 1
141 + condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues')
142 + displayName: Coerce correct build result
\ No newline at end of file