-
Notifications
You must be signed in to change notification settings - Fork 28
155 lines (151 loc) · 5.18 KB
/
ci.yml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: 'CI'
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
# lint: disabled as golangci-lint is not yet ready for Go workspaces
test:
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
actions: read
contents: write
security-events: write
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ matrix.os == 'ubuntu-latest' }}
uses: docker/login-action@v3
with:
registry: registry.jetbrains.team
username: ${{ secrets.SPACE_USERNAME }}
password: ${{ secrets.SPACE_PASSWORD }}
- run: touch linter/tooling/clt.zip # temporary workaround
shell: bash
- name: Run tests (with coverage)
if: ${{ matrix.os != 'windows-latest' }}
run: |
set -euo pipefail
go test -json -v $(go list -f '{{.Dir}}/...' -m | xargs) -coverprofile coverage-${{ matrix.os }}.out 2>&1 | tee /tmp/gotest.log | gotestfmt
env:
QODANA_LICENSE_ONLY_TOKEN: ${{ secrets.QODANA_LICENSE_ONLY_TOKEN }}
- name: Run tests (with coverage) for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: go test -v $(go list -f '{{.Dir}}/...' -m | ForEach-Object { $_ }) -coverprofile coverage-${{ matrix.os }}.out
env:
QODANA_LICENSE_ONLY_TOKEN: ${{ secrets.QODANA_LICENSE_ONLY_TOKEN }}
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}.out
path: coverage-${{ matrix.os }}.out
code-quality:
runs-on: ubuntu-latest
needs: [ test ]
permissions:
checks: write
pull-requests: write
actions: read
contents: write
security-events: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/login-action@v3
with:
registry: registry.jetbrains.team
username: ${{ secrets.SPACE_USERNAME }}
password: ${{ secrets.SPACE_PASSWORD }}
- name: Download all coverage artifacts
uses: actions/download-artifact@v4
with:
path: cov/
- name: Merge coverage profiles
run: |
go install -v github.com/hansboder/gocovmerge@latest
mkdir -p .qodana/code-coverage
export PATH=$PATH:$(go env GOPATH)/bin
ls -R cov/
gocovmerge cov/coverage-macos-latest.out/coverage-macos-latest.out cov/coverage-ubuntu-latest.out/coverage-ubuntu-latest.out cov/coverage-windows-latest.out/coverage-windows-latest.out > .qodana/code-coverage/coverage.out
- uses: JetBrains/qodana-action@main
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
- uses: github/codeql-action/init@v3
with:
languages: go
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
release-nightly:
runs-on: ubuntu-latest
needs: [ test, code-quality ]
permissions:
checks: write
pull-requests: write
actions: read
contents: write
security-events: write
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: install chocolatey
run: |
mkdir -p /opt/chocolatey
wget -q -O - "https://github.com/chocolatey/choco/releases/download/${CHOCOLATEY_VERSION}/chocolatey.v${CHOCOLATEY_VERSION}.tar.gz" | tar -xz -C "/opt/chocolatey"
echo '#!/bin/bash' >> /usr/local/bin/choco
echo 'mono /opt/chocolatey/choco.exe $@' >> /usr/local/bin/choco
chmod +x /usr/local/bin/choco
env:
CHOCOLATEY_VERSION: 1.2.0
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser-pro
version: latest
args: --snapshot --clean --debug
workdir: cli
- run: |
cd cli/dist
gh release --repo JetBrains/qodana-cli delete nightly -y || true
git push --delete origin nightly || true
gh release --repo JetBrains/qodana-cli create nightly -p -t nightly
gh release --repo JetBrains/qodana-cli upload nightly \
qodana_darwin_arm64.tar.gz \
qodana_darwin_x86_64.tar.gz \
qodana_linux_arm64.tar.gz \
qodana_linux_x86_64.tar.gz \
qodana_windows_arm64.zip \
qodana_windows_x86_64.zip
gh release --repo JetBrains/qodana-cli edit nightly --draft=false
env:
GH_TOKEN: ${{ github.token }}
# install-script-check:
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - run: |
# ./install
# ./install nightly