Relocate and enhance user-search component #492
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: Code Quality | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
install-deps: | |
name: Install Dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- uses: actions/setup-node@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
node-version: 18.x | |
cache: 'npm' | |
- name: npm install | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci --no-scripts | |
lint: | |
name: Linting and Formatting | |
runs-on: ubuntu-latest | |
needs: install-deps | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: commitlint | |
if: github.event_name == 'pull_request' | |
run: npx commitlint | |
--from ${{ github.event.pull_request.base.sha }} | |
--to ${{ github.event.pull_request.head.sha }} | |
--verbose | |
- name: Prettier | |
run: npx nx format:check --base=origin/main | |
- name: Lint Affected | |
run: npx nx affected | |
--target=lint | |
--base=${{ github.event.pull_request.base.sha }} | |
--head=${{ github.event.pull_request.head.sha }} | |
--parallel=3 | |
test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
needs: install-deps | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
fetch-depth: 0 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Test Affected | |
run: npx nx affected | |
--target=test | |
--base=${{ github.event.pull_request.base.sha }} | |
--head=${{ github.event.pull_request.head.sha }} | |
--parallel=3 | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: install-deps | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
fetch-depth: 0 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Build Affected | |
run: npx nx affected | |
--target=build | |
--base=${{ github.event.pull_request.base.sha }} | |
--head=${{ github.event.pull_request.head.sha }} | |
--parallel=3 | |
backend-e2e: | |
name: Backend E2E Tests | |
runs-on: ubuntu-latest | |
needs: install-deps | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
fetch-depth: 0 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Check affected | |
run: | |
| | |
if npx nx show projects \ | |
--affected \ | |
--base=${{ github.event.pull_request.base.sha }} \ | |
--head=${{ github.event.pull_request.head.sha }} | | |
grep -q backend-e2e | |
then | |
echo "affected=true" >> $GITHUB_ENV | |
else | |
echo "affected=false" >> $GITHUB_ENV | |
fi | |
- name: Run tests in Docker | |
if: env.affected == 'true' | |
run: | |
docker compose | |
-f docker-compose.yml -f docker-compose.test.yml | |
run backend-e2e | |
frontend-e2e: | |
name: Frontend E2E Tests | |
runs-on: ubuntu-latest | |
needs: install-deps | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
fetch-depth: 0 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Check affected | |
run: | |
| | |
if npx nx show projects \ | |
--affected \ | |
--base=${{ github.event.pull_request.base.sha }} \ | |
--head=${{ github.event.pull_request.head.sha }} | | |
grep -q frontend-e2e | |
then | |
echo "affected=true" >> $GITHUB_ENV | |
else | |
echo "affected=false" >> $GITHUB_ENV | |
fi | |
- name: Run tests in Docker | |
if: env.affected == 'true' | |
run: | |
docker compose | |
-f docker-compose.yml -f docker-compose.test.yml | |
run frontend-e2e |