Merge pull request #19 from icelam/lint-pull-request #19
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: Build | |
on: | |
push: | |
branches: | |
- 'master' | |
tags-ignore: | |
- '**' # prevent double build on release tag | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
branches: | |
- '**' | |
# Global variables that will be load into every shell | |
env: | |
TEST_REPORT_ESLINT_FOLDER: reports/eslint | |
TEST_REPORT_ESLINT_FILENAME: eslint.json | |
jobs: | |
lint: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Run eslint checking | |
run: | | |
yarn eslint src *.js *.ts --report-unused-disable-directives --format json --output-file $REPORT_PATH | |
env: | |
REPORT_PATH: ${{ env.TEST_REPORT_ESLINT_FOLDER }}/${{ env.TEST_REPORT_ESLINT_FILENAME }} | |
- name: Annotate lint result | |
if: always() | |
uses: ataylorme/eslint-annotate-action@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
report-json: ${{ env.TEST_REPORT_ESLINT_FOLDER }}/${{ env.TEST_REPORT_ESLINT_FILENAME }} | |
only-pr-files: false | |
- name: Preserve lint report as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lint-report | |
path: ${{ env.TEST_REPORT_ESLINT_FOLDER }}/* | |
retention-days: ${{ env.DEFAULT_ARTIFACT_RETENTION_DAYS }} | |
build: | |
name: Build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Build | |
run: | | |
yarn build | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ runner.os }} # artifacts zip name | |
path: | | |
dist |