Updated syntax in utils.js with async/await #1517
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: CI | |
on: | |
push: | |
branches: [ master ] | |
# Triggers the workflow on pull request events in the context of the fork | |
# trying to sidestep limitations here: https://github.com/wearerequired/lint-action/issues/13 | |
pull_request: | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:12.3 | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: bookbrainz_test | |
# Since we run npm tests on the host machine (not in a docker container) | |
# we need to bind the Postgres port from Docker container to host machine | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Install PostgreSQL client | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes postgresql-client | |
#Set up ElasticSearch | |
- name: Run Elasticsearch | |
# Replace this with official elastic-github-actions/elasticsearch once they are ready for prod | |
uses: getong/[email protected] | |
with: | |
elasticsearch version: '5.6.8' | |
host port: 9200 | |
container port: 9200 | |
host node port: 9300 | |
node port: 9300 | |
discovery type: 'single-node' | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Set up the test dabatase | |
- name: Set up test database in PostgreSQL | |
run: ./scripts/create-test-db.sh | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: bookbrainz_test | |
POSTGRES_HOST: localhost | |
- name: Set up node | |
uses: actions/setup-node@v1 | |
with: | |
# We could also test on multiple Node versions if needed: https://github.com/actions/setup-node#matrix-testing | |
node-version: '18' | |
# Enables caching NPM dependencies (uses https://github.com/actions/cache under the hood) | |
cache: 'yarn' | |
# Performs a clean installation of all dependencies in the `package.json` file | |
# For more information, see https://docs.npmjs.com/cli/ci.html | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run tests | |
run: yarn run test-ci # run tests (configured to use mocha's json reporter) | |
- name: Export test results | |
uses: actions/upload-artifact@v4 # upload test results | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: test-results | |
path: test-results.json |