Static map list system #667
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 | |
- name: Original node_modules Cache | |
uses: actions/cache@v3 | |
id: original_cache | |
with: | |
path: node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: node_modules Cache with Prisma Client | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ github.run_id }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: 'npm' | |
- name: npm install | |
if: steps.original_cache.outputs.cache-hit != 'true' | |
run: npm ci --no-scripts | |
- name: prisma generate | |
run: npx nx run db:generate | |
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-${{ github.run_id }} | |
- 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 | |
submodules: 'true' | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ github.run_id }} | |
- 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 | |
submodules: 'true' | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: modules-${{ github.run_id }} | |
- 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-${{ github.run_id }} | |
- 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 | |
# Disabled until we allow using this site without a Steam login | |
# https://github.com/momentum-mod/website/issues/878 | |
# 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 | |
# submodules: 'true' | |
# - name: Cache node_modules | |
# uses: actions/cache@v3 | |
# with: | |
# path: node_modules | |
# key: modules-${{ github.run_id }} | |
# - 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 |