Skip to content

Commit

Permalink
🔥 Merge Qodana Azure Pipelines extension
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Mar 25, 2022
1 parent 3dc9086 commit 3c22022
Show file tree
Hide file tree
Showing 45 changed files with 30,873 additions and 28,719 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 'actions-build-test'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- 'releases/*'

jobs:
check-dist:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set Node.js 12.x
uses: actions/[email protected]
with:
node-version: 12.x
- name: Install dependencies
run: cd action && npm ci
- name: Rebuild the dist/ directory
run: cd scan && npm run build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol scan/dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different from expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: scan/dist/

build: # make sure build/ci work properly
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
steps:
- uses: actions/checkout@v2
- run: |
cd scan
npm install
npm test
test-ubuntu: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
linter: jetbrains/qodana-js

# Not possible at the moment for GitHub-hosted Windows agents: https://github.com/JetBrains/qodana-action/pull/31#issue-812728409
# test-windows:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v2
# - uses: ./
# with:
# linter: jetbrains/qodana-js
51 changes: 0 additions & 51 deletions .github/workflows/check-dist.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
curl -L -o grazie-pro.zip "$GRAZIE_PLUGIN" && unzip grazie-pro.zip
mv grazie-pro ${{ runner.temp }}/grazie-pro && rm -f grazie-pro.zip
- name: 'Qodana Scan'
uses: JetBrains/[email protected].2
uses: JetBrains/[email protected].5
with:
linter: jetbrains/qodana-js
additional-volumes: |
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/test.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/vsts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'vsts-build-test'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- 'releases/*'

jobs:
build: # make sure build/ci work properly
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
steps:
- uses: actions/checkout@v2
- run: |
cd vsts
npm install
npm run build
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Dependency directory
node_modules
**/node_modules
**/lib
.idea
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
Expand Down Expand Up @@ -95,5 +97,5 @@ typings/
Thumbs.db

# Ignore built ts files
__tests__/runner/*
scan/__tests__/runner/*
lib/**/*
19 changes: 19 additions & 0 deletions .space.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
job("publish ci-common") {
container(displayName = "Run publish script", image = "node:16-alpine") {
env["REGISTRY"] = "https://packages.jetbrains.team/npm/p/sa/npm-public/"
shellScript {
content = """
cd common
npm ci
npm run build --if-present
npm run test
echo "registry = ${'$'}REGISTRY" >> ~/.npmrc
AUTH=${'$'}(echo -ne "${'$'}JB_SPACE_CLIENT_ID:${'$'}JB_SPACE_CLIENT_SECRET" | base64 | tr -d \\n)
echo "_auth = ${'$'}AUTH" >> ~/.npmrc
echo "email = [email protected]" >> ~/.npmrc
echo "always-auth = true" >> ~/.npmrc
npm run publish
"""
}
}
}
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
[![Twitter Follow](https://img.shields.io/twitter/follow/Qodana?style=social&logo=twitter)][jb:twitter]

**Qodana** is a code quality monitoring tool that identifies and suggests fixes for bugs, security vulnerabilities,
duplications, and imperfections. Using this GitHub Action, run Qodana with your GitHub workflow to scan your Java,
Kotlin, PHP, Python, JavaScript, TypeScript projects (
and [other supported technologies by Qodana](https://www.jetbrains.com/help/qodana/supported-technologies.html)).

duplications, and imperfections.
**Table of Contents**

<!-- toc -->
Expand All @@ -21,6 +18,8 @@ and [other supported technologies by Qodana](https://www.jetbrains.com/help/qoda

<!-- tocstop -->

> 💡 This README is about Qodana GitHub action. To learn more about Qodana Azure Pipelines, please visit [Qodana for Azure Pipelines](./vsts/README.md).
## Usage

### Basic configuration
Expand All @@ -47,8 +46,7 @@ jobs:
```
Using this workflow, Qodana will run on the main branch, release branches, and on the pull requests coming to your
repository. Inspection results will be available in the GitHub UI. The `jetbrains/qodana-<linter>` option specifies a
[Qodana linter](linters.md).
repository.
We recommend that you have a separate workflow file for Qodana
because [different jobs run in parallel](https://help.github.com/en/actions/getting-started-with-github-actions/core-concepts-for-github-actions#job)
Expand Down Expand Up @@ -174,17 +172,17 @@ To do it, follow these steps:

Most likely you won't need other options than `args`: all other options can be useful if you are configuring multiple Qodana Scan jobs in one workflow.

| Name | Description | Default Value |
|-------------------------|-----------------------------------------------------------------------------------------|-------------------------------------|
| `args` | [Qodana CLI `scan` arguments](https://github.com/jetbrains/qodana-cli#scan). Optional. | - |
| `results-dir` | Directory to store the analysis results. Optional. | `${{ runner.temp }}/qodana/results` |
| `cache-dir` | Directory to store Qodana caches. Optional. | `${{ runner.temp }}/qodana/caches` |
| `use-caches` | Utilize GitHub caches for Qodana runs. Optional. | `true` |
| `additional-cache-hash` | Allows customizing the generated cache hash. Optional. | `${{ github.sha }}` |
| `upload-result` | Upload Qodana results as an artifact to the job. Optional. | `true` |
| `artifact-name` | Specify Qodana results artifact name, used for results uploading. Optional. | `Qodana report` |
| `use-annotations` | Use annotation to mark the results in the GitHub user interface. Optional. | `true` |
| `github-token` | GitHub token to be used for uploading annotations. Optional. | `${{ github.token }}` |
| Name | Description | Default Value |
|-----------------------|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| `args` | Additional [Qodana CLI](https://github.com/jetbrains/qodana-cli) arguments, split the arguments with commas (`,`). Optional. | - |
| `resultsDir` | Directory to store the analysis results. Optional. | `${{ runner.temp }}/qodana/results` |
| `uploadResults` | Upload Qodana results as an artifact to the job. Optional. | `true` |
| `artifactName` | Specify Qodana results artifact name, used for results uploading. Optional. | `Qodana report` |
| `cacheDir` | Directory to store Qodana caches. Optional. | `${{ runner.temp }}/qodana/caches` |
| `syncCache` | Utilize GitHub caches for Qodana runs. Optional. | `true` |
| `additionalCacheHash` | Allows customizing the generated cache hash. Optional. | `${{ github.sha }}` |
| `useAnnotations` | Use annotation to mark the results in the GitHub user interface. Optional. | `true` |
| `githubToken` | GitHub token to be used for uploading results. Optional. | `${{ github.token }}` |

## Issue Tracker

Expand Down
24 changes: 12 additions & 12 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@ branding:
icon: "bar-chart-2"
inputs:
args:
description: 'Qodana CLI arguments'
description: 'Additional Qodana CLI arguments. Separate multiple arguments with commas (`,`).'
required: false
default: ""
results-dir:
resultsDir:
description: 'Directory to store the analysis results'
required: false
default: "${{ runner.temp }}/qodana/results"
cache-dir:
cacheDir:
description: 'Directory to store Qodana caches'
required: false
default: "${{ runner.temp }}/qodana/caches"
use-caches:
description: 'Utilize GitHub caches for Qodana runs'
syncCache:
description: 'Automatically restore and save Qodana caches using GitHub caches'
required: false
default: "true"
additional-cache-hash:
additionalCacheHash:
description: 'Pass additional cache hash extension'
required: false
default: "${{ github.sha }}"
upload-result:
uploadResults:
description: 'Upload Qodana results as an artifact to the job'
required: false
default: "true"
artifact-name:
artifactName:
description: 'Specify Qodana results artifact name, used for results uploading'
required: false
default: "Qodana report"
use-annotations:
default: "qodana-report"
useAnnotations:
description: 'Use annotation to mark the results in the GitHub user interface'
required: false
default: "true"
github-token:
githubToken:
description: 'GitHub token to be used for uploading annotations'
required: false
default: ${{ github.token }}
runs:
using: 'node12'
main: 'dist/index.js'
main: 'scan/dist/index.js'
28 changes: 28 additions & 0 deletions common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@qodana/ci-common",
"version": "0.7.4X",
"description": "Qodana CI shared code for various JS extensions",
"main": "lib/qodana.js",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/JetBrains/qodana-cli.git"
},
"files": [
"qodana.ts",
"lib"
],
"scripts": {
"build": "rm -rf lib/ && tsc",
"publish": "npm run build && npm publish --registry https://packages.jetbrains.team/npm/p/sa/npm-public/"
},
"homepage": "https://github.com/JetBrains/qodana-action",
"author": "JetBrains",
"contributors": [
{
"name": "Viktor Tiulpin",
"url": "https://github.com/tiulpin"
}
],
"dependencies": {
"@types/node": "^17.0.17"
}
}
Loading

0 comments on commit 3c22022

Please sign in to comment.