Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Bump xu-cheng/texlive-full from 20230401 to 20230501 in /.devcontainer #829

Bump xu-cheng/texlive-full from 20230401 to 20230501 in /.devcontainer

Bump xu-cheng/texlive-full from 20230401 to 20230501 in /.devcontainer #829

Workflow file for this run

name: Application Tests
on:
pull_request:
push:
branches:
- main
- test-me-*
workflow_dispatch:
jobs:
changes:
name: 🧞 Check What Changed
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.filter.outputs.continue }}
steps:
- name: 🛎 Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: 🧞 Check What Changed
id: filter
run: scripts/what-code-changed ${{ github.ref_name == 'main' && '--main' || '' }} ${{ github.event_name == 'workflow_dispatch' && '--all' || '' }}
app_tests:
name: 🧪 Unit Tests
runs-on: ubuntu-latest
needs:
- changes
if: needs.changes.outputs.run_tests == 'true'
steps:
- name: 🛎 Checkout
uses: actions/checkout@v3
- name: 💻 Setup Node
uses: actions/setup-node@v3.6.0
with:
node-version: "16"
- name: 💿 Cache Node Modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: "${{ runner.os }}-build-${{ env.cache-name }}\
-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: 🚧 Install Dependencies
run: npm ci
- name: 🧪 Run Tests
run: npx jest --group=unit --config=jest.unit.config.js
- name: 💾 Save Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-unit.json
path: coverage-unit/coverage-final.json
sys_tests:
name: 🧪 Integration Tests
runs-on: ubuntu-latest
needs:
- changes
if: needs.changes.outputs.run_tests == 'true'
env:
DATABASE_URL: mysql://root:password@localhost:3306/sayyara
steps:
- name: 🛎 Checkout
uses: actions/checkout@v3
- name: 💻 Setup Node
uses: actions/setup-node@v3.6.0
with:
node-version: "16"
- name: 💿 Cache Node Modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: "${{ runner.os }}-build-${{ env.cache-name }}\
-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: 🚧 Install Dependencies
run: npm ci
- name: 🗄️ Start MySQL Database
run: docker compose up -d --wait
- name: 📋 Apply Prisma Schema
run: npx prisma db push
- name: 🧪 Run Tests
run: npx jest --runInBand --group=integration --config=jest.integration.config.js
- name: 💾 Save Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-integration.json
path: coverage-integration/coverage-final.json
coverage_report:
name: 📊 Coverage Report
runs-on: ubuntu-latest
needs:
- app_tests
- sys_tests
- changes
if: needs.changes.outputs.run_tests == 'true'
steps:
- name: 🛎 Checkout
uses: actions/checkout@v3
- name: 💻 Setup Node
uses: actions/setup-node@v3.6.0
with:
node-version: "16"
- name: 💿 Cache Node Modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: "${{ runner.os }}-build-${{ env.cache-name }}\
-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: 🚧 Install Dependencies
run: npm ci
- name: 📥 Download Coverage Reports
uses: actions/download-artifact@v3.0.2
- name: 🚧 Move Reports To Correct Directory
run: |
mkdir coverage
mv -v "coverage-unit.json/coverage-final.json" "coverage/coverage-unit.json"
mv -v "coverage-integration.json/coverage-final.json" "coverage/coverage-integration.json"
- name: 🚧 Build Coverage Report
run: npx nyc report --temp-dir coverage --reporter cobertura
- name: 🚧 Build Coverage Report Summary
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage/cobertura-coverage.xml
format: markdown
output: both
# fail_below_min: true
thresholds: "60 80"
- name: 📝 Get Comment Body
id: comment-body
run: |
echo -e "# Code Coverage Report\n$(cat code-coverage-results.md)" > code-coverage-results-with-title.md
body="$(cat code-coverage-results-with-title.md)"
delimiter="$(openssl rand -hex 8)"
echo "body<<$delimiter" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT
- name: 📤 Add Coverage Commit Comment
uses: peter-evans/commit-comment@v2
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
body: ${{ steps.comment-body.outputs.body }}
- name: 📤 Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2.5.0
if: github.event_name == 'pull_request'
with:
recreate: true
message: ${{ steps.comment-body.outputs.body }}
collect_results:
name: 📋 Collect Test Results
needs:
- changes
- app_tests
- sys_tests
- coverage_report
if: always()
runs-on: ubuntu-latest
steps:
- name: 📋 Check for Failures
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: echo job failed && exit 1