Merge pull request #553 from usethesource/update-example-extension #1174
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: Lint | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
# Replace pull_request with pull_request_target if you | |
# plan to use this action with forks, see the Limitations section | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- '**' | |
permissions: | |
checks: write | |
contents: write | |
jobs: | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # sonar needs full checkout for better blame information | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Build and analyze java | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn -f ./rascal-lsp/pom.xml -Pcoverage -B -Drascal.compile.skip -Drascal.tutor.skip verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=usethesource_rascal-language-servers | |
eslint: | |
name: eslint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: rascal-vscode-extension/package-lock.json | |
registry-url: 'https://registry.npmjs.org' | |
- name: Package & compile extension | |
working-directory: ./rascal-vscode-extension | |
run: npm ci | |
- name: Run linters | |
uses: wearerequired/lint-action@v2 | |
with: | |
eslint: true | |
eslint_dir: ./rascal-vscode-extension | |
eslint_args: "src" | |
eslint_extensions: ts | |
checkstyle: | |
name: checkstyle | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} # run it on the PR, not on the merged commit, for better line numbers | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Run checkstyle and print errors | |
run: mvn -B checkstyle:checkstyle checkstyle:check | |
working-directory: ./rascal-lsp | |
- name: Report build results | |
uses: gmazzo/publish-report-annotations@v1 # target latest major | |
if: ${{ !cancelled() }} | |
with: | |
testsSummary: off | |
reports: "rascal-lsp/target/checkstyle-result.xml" | |
githubql: | |
strategy: | |
matrix: | |
include: | |
- language: java | |
build-mode: manual | |
- language: typescript | |
build-mode: none | |
name: githubql | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
permissions: | |
# required for all workflows | |
security-events: write | |
# required to fetch internal or private CodeQL packs | |
packages: read | |
# only required for workflows in private repositories | |
actions: read | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- if: ${{ matrix.language == 'java' }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
build-mode: ${{ matrix.build-mode }} | |
- if: ${{ matrix.language == 'java' }} | |
name: Build java | |
run: mvn -B compile -Drascal.compile.skip -Drascal.tutor.skip -DskipTests | |
working-directory: rascal-lsp/ | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
with: | |
category: "/language:${{matrix.language}}" |