v2023.3 #310
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'CI' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: golangci-lint | |
uses: reviewdog/action-golangci-lint@v2 | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: [ lint ] | |
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@v4 | |
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 }} | |
- name: Run tests (with coverage) | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
set -euo pipefail | |
go test -json -v ./... -coverprofile coverage-${{ matrix.os }}.out -coverpkg=./... 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 -json -v ./... -coverprofile coverage-${{ matrix.os }}.out -coverpkg=./... | |
env: | |
QODANA_LICENSE_ONLY_TOKEN: ${{ secrets.QODANA_LICENSE_ONLY_TOKEN }} | |
- name: Upload coverage artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-${{ matrix.os }}.out | |
path: coverage-${{ matrix.os }}.out | |
code-quality: | |
runs-on: ubuntu-latest | |
needs: [ lint, 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@v3 | |
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 }} | |
with: | |
args: --fail-threshold,0 | |
- uses: github/codeql-action/init@v2 | |
with: | |
languages: go | |
- uses: github/codeql-action/autobuild@v2 | |
- uses: github/codeql-action/analyze@v2 | |
release-nightly: | |
runs-on: ubuntu-latest | |
needs: [ lint, test, code-quality ] | |
if: github.ref == 'refs/heads/233' | |
permissions: | |
checks: write | |
pull-requests: write | |
actions: read | |
contents: write | |
security-events: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v4 | |
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 | |
version: latest | |
args: --snapshot --clean --debug | |
- run: | | |
cd 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_all.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: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
./install |