Run Tests #2109
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: Run Tests | |
on: | |
pull_request: {} | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 0' # 0:00 UTC on every sunday | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: npm | |
- run: npm ci | |
- run: npm run lint:ci | |
test: | |
name: Jest w/ react@${{ matrix.react.react-version }} @line/liff@${{ matrix.liff-sdk.sdk-version }} | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.liff-sdk.continue-on-error }} | |
strategy: | |
fail-fast: false | |
matrix: | |
react: | |
- react-version: 18 | |
liff-sdk: | |
- sdk-version: '2.19' | |
continue-on-error: false | |
- sdk-version: '2.20' | |
continue-on-error: false | |
- sdk-version: '2.21' | |
continue-on-error: false | |
- sdk-version: '2.22' | |
continue-on-error: false | |
- sdk-version: latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: npm | |
- run: npm ci | |
- name: Reinstall specific version of react.js | |
run: | | |
npm i \ | |
react@${{ matrix.react.react-version }} \ | |
react-dom@${{ matrix.react.react-version }} \ | |
@types/react@${{ matrix.react.react-version }} | |
- name: Reinstall specific version of @line/liff SDK | |
run: npm i @line/liff@${{ matrix.liff-sdk.sdk-version }} | |
- name: npm run test && report coverage | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: de17efec54641dd4eb561f1b0bdede12f7e310f921137eb3465771b63cbbe2f0 | |
with: | |
coverageCommand: npm run test:ci | |
coverageLocations: | | |
${{ github.workspace }}/coverage/lcov.info:lcov | |
debug: true | |
- name: Reset local changes | |
run: git checkout . && npm ci | |
build: | |
needs: test | |
name: Build react-liff | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: npm | |
- run: npm ci | |
- run: npm run build | |
- name: Upload the result of build react-liff | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
build-example-app: | |
needs: build | |
name: Build example app | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: examples/simple | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: npm | |
- name: Download the result of build react-liff | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- run: npm i && npm run build |