Use r-lib/actions to lint R files #2020
This file contains hidden or 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: main | |
| on: [push, pull_request] | |
| env: | |
| SCRIPT_DIR: ./.github/scripts | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - run: yarn install | |
| - name: Run tests | |
| uses: GabrielBB/xvfb-action@v1.0 | |
| with: | |
| run: npm run test | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| VSIX_FILE: vscode-R.vsix | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - run: node $SCRIPT_DIR/enableWebpack.js | |
| - run: yarn install | |
| - uses: lannonbr/vsce-action@master | |
| with: | |
| args: "package -o $VSIX_FILE" | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: ${{ env.VSIX_FILE }} | |
| path: ${{ env.VSIX_FILE }} | |
| eslint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - run: yarn install | |
| - run: yarn run lint | |
| markdownlint-cli: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: nosborn/github-action-markdown-cli@v1.1.1 | |
| with: | |
| files: . | |
| config_file: ".markdownlint.json" | |
| ignore_files: "node_modules/*" | |
| lint: | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - name: Install lintr | |
| run: install.packages("lintr") | |
| shell: Rscript {0} | |
| - name: Lint root directory | |
| run: lintr::lint_dir("./R") | |
| shell: Rscript {0} | |
| env: | |
| LINTR_ERROR_ON_LINT: true | |
| devreplay: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - run: yarn install | |
| - name: Run devreplay | |
| run: ./node_modules/.bin/devreplay ./src devreplay.json |