CI - Tests #165
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
# Single GitHub Action to run tests against the codebase | |
# This test includes integration tests and unit tests all in one. | |
name: CI - Tests | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: [ "CI - Standards" ] | |
types: | |
- completed | |
# Using this to prevent simultaneous runs, outdating local git cache | |
env: | |
# Setup all Environment Variables as tests check they exist. | |
PORT: 8080 | |
SERVERURL: "https://test.github.com" | |
PAGINATE: 30 | |
CACHETIME: 600000 | |
GCLOUD_STORAGE_BUCKET: "" | |
GOOGLE_APPLICATION_CREDENTIALS: "nofile" | |
GH_CLIENTID: "" | |
GH_CLIENTSECRET: "" | |
GH_USERAGENT: "Pulsar-Edit Tester Bot" | |
GH_REDIRECTURI: "http://localhost:8080/api/oauth" | |
DB_HOST: "" | |
DB_USER: "" | |
DB_PASS: "" | |
DB_DB: "" | |
DB_PORT: 43 | |
DB_SSL_CERT: "" | |
LOG_LEVEL: 6 | |
LOG_FORMAT: "stdout" | |
# This helps some modules know they are in a test environment | |
NODE_ENV: "test" | |
PULSAR_STATUS: "dev" | |
RATE_LIMIT_GENERIC: 0 | |
RATE_LIMIT_AUTH: 0 | |
WEBHOOK_PUBLISH: "" | |
WEBHOOK_VERSION: "" | |
WEBHOOK_USERNAME: "" | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
node-version: [17.x, 18.x, 19.x] | |
steps: | |
- name: Checkout the latest code | |
uses: actions/checkout@v3 | |
- name: Setup NodeJS - ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm install | |
- name: Run Tests | |
run: npm run test | |
- name: Codecov Upload | |
if: always() # Needed to ensure coverage is commited even on test failure | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage/clover.xml | |
#- name: Coveralls Upload | |
#if: always() # Needed to ensure coverage is commited even on test failure | |
#uses: coverallsapp/github-action@master | |
#with: | |
#github-token: ${{ secrets.GITHUB_TOKEN }} |