Repository navigation
97 lines (93 loc) · 3.34 KB
/
Copy pathci.yml
File metadata and controls
97 lines (93 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: CI
on:
pull_request:
push:
branches: [develop, main]
permissions:
contents: read
env:
# A missing hg or svn is a failure in CI, not a skipped test.
SYSPI_REQUIRE_VCS: "1"
jobs:
gate:
name: Go gate (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
- name: Install mercurial and subversion (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update -q && sudo apt-get install -y -q mercurial subversion
- name: Install mercurial and subversion (macOS)
if: runner.os == 'macOS'
run: brew install mercurial subversion
- name: Install mercurial and subversion (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install -y --no-progress hg sliksvn
Add-Content $env:GITHUB_PATH 'C:\Program Files\Mercurial'
Add-Content $env:GITHUB_PATH 'C:\Program Files\SlikSvn\bin'
- name: Versions
run: go version && git --version && hg --version | head -1 && svn --version --quiet
- name: Build
run: go build ./...
- name: Vet
run: go vet ./...
- name: gofmt
run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
- name: Tidy
run: go mod tidy && git diff --exit-code go.mod go.sum
- name: Unit and end-to-end tests
run: go test -count=1 ./...
install-scripts:
name: Installers against a fake release (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
- name: install.sh and install.ps1
if: runner.os != 'Windows'
run: scripts/install-test.sh
- name: install.ps1
if: runner.os == 'Windows'
shell: pwsh
run: scripts/install-test.ps1
changelog-fragments:
name: Changelog fragments well-formed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- run: python3 scripts/changelog.py check
changelog:
name: Changelog fragment
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Require a fragment for code changes
run: |
base="${{ github.event.pull_request.base.sha }}"
if git diff --name-only "$base" HEAD | grep -qE '^(cmd|internal|tests)/'; then
git diff --name-only --diff-filter=A "$base" HEAD | grep -E '^changes/unreleased/.+\.(added|changed|fixed|removed|deprecated|security)\.md$' \
|| { echo "code changed but no changes/unreleased/<slug>.<section>.md fragment was added"; exit 1; }
fi