Skip to content

GitHub actions

GitHub actions #35

name: Landonlite Frontend Workflow
on:
pull_request:
branches:
- "master"
jobs:
compare-changes:
uses: ./.github/workflows/compare-changes.yml
print-compare-changes-output:
runs-on: ubuntu-latest
needs: compare-changes
steps:
- run: echo "FrontendDisable ${{ needs.compare-changes.outputs.frontendDisable }}"
- run: printf "should run frontend CI ${{ needs.compare-changes.outputs.frontendDisable == 'false' }}\n"
skip-frontend-test:
needs:
- compare-changes
runs-on: ubuntu-latest
steps:
- run: echo "Skipping frontend tests ${{ needs.compare-changes.outputs.frontendDisable }}"
echo ${{ !needs.compare-changes.outputs.frontendDisable }}
echo ${{ needs.compare-changes.outputs.frontendDisable == false }}
echo ${{ needs.compare-changes.outputs.frontendDisable == 'false' }}
echo "Skipping backend tests ${{ needs.compare-changes.outputs.backendDisable }}"
echo ${{ needs.compare-changes.outputs.backendDisable == true }}
echo ${{ needs.compare-changes.outputs.backendDisable == 'true' }}
frontend-test:
needs:
- compare-changes
if: ${{ !needs.compare-changes.outputs.frontendDisable }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./web
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache npm packages
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test