Merge pull request #203 from almasen/dev #370
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: Build | |
# Trigger on push or pull request | |
on: | |
push: | |
branches: | |
- master # master (rerun tests after merging a PR) | |
- dev | |
pull_request: | |
branches: | |
- master | |
- dev | |
jobs: | |
# build and run tests | |
build: | |
runs-on: ubuntu-latest | |
# setup node, build, and run tests | |
steps: | |
- name: Checkout GitHub repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js 12.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: Install npm packages | |
working-directory: ./server | |
run: npm ci | |
- name: Run ESLint | |
working-directory: ./server | |
run: npx eslint ./ | |
- name: Generate API documentation | |
run: npm run docs | |
working-directory: ./server | |
- name: Create API documentation artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: docs | |
path: server/out | |
test: | |
needs: build | |
services: | |
postgres: | |
image: postgres:12.1 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: asd123 | |
POSTGRES_DB: rdfdatabase | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a health check | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
CI: true | |
DB_USER: postgres | |
DB_PASS: asd123 | |
DB_HOST: localhost | |
DB_DATABASE: rdfdatabase | |
SESSION_SECRET: tnahpele | |
SERVER_SECRET: tnahpele | |
DEFAULT_EMAIL_ADDRESS: test@rdfmapped.com | |
CONTACT_EMAIL_ADDRESS: test@rdfmapped.com | |
SUBMISSION_EMAIL_ADDRESS: test@rdfmapped.com | |
BUG_REPORT_EMAIL_ADDRESS: test@rdfmapped.com | |
SENDGRID_API_KEY: SG.abc123 | |
PRESERVE_SESSIONS_ON_REBOOT: 0 | |
SYMMETRIC_ENC_ENABLED: 1 | |
LINKEDIN_LEARNING_ID: elephant | |
LINKEDIN_LEARNING_SECRET: tnahpele | |
LINKEDIN_LEARNING_TOKEN: token | |
GOOGLE_RECAPTCHA_KEY: abc123 | |
GOOGLE_RECAPTCHA_SECRET: 321cba | |
GITHUB_TOKEN: token | |
CREATE_GITHUB_ISSUES: 1 | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout Github repository | |
uses: actions/checkout@v2 | |
- name: set up Node.js 12.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: npm install | |
working-directory: ./server | |
run: npm ci | |
- name: run database migrations | |
working-directory: ./server | |
run: npm run db-migrate up | |
- name: npm test | |
run: npm test | |
working-directory: ./server | |
- name: Create test coverage artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: coverage | |
path: server/coverage | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout GitHub repository | |
uses: actions/checkout@master | |
- name: Download coverage artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: coverage | |
- name: Publish test coverage | |
uses: easingthemes/ssh-deploy@v2.1.4 | |
env: | |
SOURCE: "coverage" | |
TARGET: ${{ secrets.COVERAGE_DIR }} | |
REMOTE_HOST: ${{ secrets.SSH_HOST }} | |
REMOTE_USER: ${{ secrets.SSH_USER }} | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY_DEP }} | |
- name: Download docs artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: docs | |
- name: Publish module documentation | |
uses: easingthemes/ssh-deploy@v2.1.4 | |
env: | |
SOURCE: "docs" | |
TARGET: ${{ secrets.DOCS_DIR }} | |
REMOTE_HOST: ${{ secrets.SSH_HOST }} | |
REMOTE_USER: ${{ secrets.SSH_USER }} | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY_DEP }} |