This repository has been archived by the owner on May 3, 2024. It is now read-only.
for demo only #2405
Workflow file for this run
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: "[on PR, Trunk] One App Unit and Lint Tests" | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- 5.x.x | |
jobs: | |
one-app-unit-tests: | |
name: One App Unit and Lint Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: npm install | |
run: npm ci | |
env: | |
NODE_ENV: development | |
HUSKY: 0 | |
- name: npm run build | |
run: npm run build | |
env: | |
NODE_ENV: production | |
- name: npm unit test | |
run: npm run test:unit | |
- name: npm lint test | |
run: npm run test:lint | |
- name: get target branch name | |
id: vars | |
run: | | |
if [[ "${{github.event_name == 'pull_request'}}" == "true" ]] | |
then | |
echo "short_ref=${{github.base_ref}}" >> $GITHUB_OUTPUT | |
else | |
echo "short_ref=${{github.ref_name}}" >> $GITHUB_OUTPUT | |
fi | |
- name: npm commit lint | |
run: npm run test:git-history -- --from origin/${{ steps.vars.outputs.short_ref }} | |