fix(hot-tracks): don't include invalid SoundCloud eId
(#719)
#1807
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: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
CI: true | |
FORCE_COLOR: '3' # asks Chalk to use colors in logs of Yarn, Jest, ESLint and many others | |
jobs: | |
dependencies: | |
name: Check dependencies (with audit) | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci | |
decommission: | |
name: Decommission of user cache | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci --prefer-offline --no-audit | |
- name: count references to usernames cache | |
shell: bash | |
run: ./scripts/legacy-refs/check-refs.sh | |
code-checks: | |
name: Code checks | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci --prefer-offline --no-audit | |
- name: make build | |
run: | | |
make build | |
echo 'βΉοΈ If this test fails, run `$ npm run build` and commit the changes.' | |
exit $(git diff | wc -l) | |
- name: make lint | |
run: | | |
make lint | |
echo 'βΉοΈ If this test fails, run `$ make lint` and commit the changes.' | |
exit $(git diff | wc -l) | |
approval-tests: | |
name: Approval tests | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
services: | |
mongodb: | |
image: docker://mongo:3.6 | |
ports: | |
- 27117:27017 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci --prefer-offline --no-audit | |
- name: Approval tests on Hot Tracks | |
run: npm run test:approval:hot-tracks:start | |
- name: Approval tests on posting tracks | |
run: npm run test:approval:posting:start | |
- name: Approval tests on main routes | |
run: npm run test:approval:routes:start | |
unit-tests: | |
name: Unit tests | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci --prefer-offline --no-audit | |
- name: Unit tests | |
run: npm run test:unit:coverage | |
- name: Get coverage data | |
run: npm run coverage:report | |
- name: Save code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: unit-tests-code-coverage-report | |
path: | | |
.nyc_output | |
coverage | |
functional-tests: | |
name: Functional tests | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci --prefer-offline --no-audit | |
- name: Functional tests | |
run: npm run test:functional:coverage | |
- name: Get coverage data | |
run: npm run coverage:report | |
- name: Save code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: functional-tests-code-coverage-report | |
path: | | |
.nyc_output | |
coverage | |
integration-tests: | |
name: Integration tests | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
services: | |
mongodb: | |
image: docker://mongo:3.6@sha256:146c1fd999a660e697aac40bc6da842b005c7868232eb0b7d8996c8f3545b05d | |
ports: | |
- 27117:27017 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci --prefer-offline --no-audit | |
- run: npm run test:api:coverage | |
- run: npm run test:integration:coverage | |
- name: Get coverage data | |
run: npm run coverage:report | |
- name: Save code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: integration-tests-code-coverage-report | |
path: | | |
.nyc_output | |
coverage | |
third-party-tests: | |
name: 3rd-party tests | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: npm ci --prefer-offline --no-audit | |
- env: | |
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_TEST_APP_ID }} | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_TEST_API_KEY }} | |
run: npm run test:3rd-party | |
cypress-tests: | |
name: Cypress E2E tests | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
timeout-minutes: 8 | |
runs-on: ubuntu-20.04 | |
services: | |
mongodb: | |
image: docker://mongo:3.6 | |
ports: | |
- 27117:27017 | |
strategy: | |
# when one test fails, DO NOT cancel the other | |
# containers, because this will kill Cypress processes | |
# leaving the Dashboard hanging ... | |
# https://github.com/cypress-io/github-action/issues/48 | |
fail-fast: false | |
matrix: | |
# run 3 copies of the current job in parallel | |
containers: [1, 2, 3] | |
steps: | |
# to avoid browserVersion mismatch, cf https://github.com/cypress-io/github-action/issues/518#issuecomment-1210979047 | |
- uses: browser-actions/setup-chrome@latest | |
- run: | | |
echo "Chrome version: $(chrome --version)" | |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '${{ steps.nvmrc.outputs.node_version }}' | |
cache: 'npm' | |
- uses: c-py/action-dotenv-to-setenv@v4 | |
with: | |
env-file: env-vars-testing.conf | |
- run: npm ci --prefer-offline --no-audit | |
- name: Run Cypress tests against Openwhyd server | |
uses: cypress-io/github-action@v6.4.0 | |
with: | |
start: npm run start:coverage --mongoDbDatabase openwhyd_test | |
wait-on: 'http://localhost:8080' | |
config-file: cypress.config.ts | |
browser: '${{ env.BROWSER_PATH }}' # chromium/chrome is required to include browser console in cypress logs | |
install: false | |
record: true | |
parallel: true | |
env: | |
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} | |
# pass the Dashboard record key as an environment variable | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# Recommended: pass the GitHub token lets this action correctly | |
# determine the unique run id necessary to re-run the checks | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# DEBUG: 'cypress:server:socket-base' | |
# ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_TEST_APP_ID }} | |
# ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_TEST_API_KEY }} | |
- name: Get coverage data | |
run: npm run coverage:report # stores the coverage report in coverage/lcov.info | |
- name: Save code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-code-coverage-report | |
path: | | |
.nyc_output | |
coverage | |
# NOTE: screenshots will be generated only if E2E test failed | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
# Test run video was always captured, so this action uses "always()" condition | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: cypress-videos | |
path: cypress/videos | |
coverage: | |
name: Send coverage reports to Codacy | |
needs: | |
- cypress-tests | |
- approval-tests | |
- unit-tests | |
- functional-tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: cypress-code-coverage-report | |
path: coverage-cypress/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: unit-tests-code-coverage-report | |
path: coverage-unit-tests/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: functional-tests-code-coverage-report | |
path: coverage-functional-tests/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: integration-tests-code-coverage-report | |
path: coverage-integration-tests/ | |
- name: Merge coverage reports | |
run: | | |
mkdir .nyc_output | |
mkdir coverage-reports | |
cp coverage-cypress/.nyc_output/*.json coverage-reports | |
cp coverage-unit-tests/.nyc_output/*.json coverage-reports | |
cp coverage-functional-tests/.nyc_output/*.json coverage-reports | |
cp coverage-integration-tests/.nyc_output/*.json coverage-reports | |
npx --yes nyc merge coverage-reports .nyc_output/merged-coverage.json | |
npm run coverage:report # stores the coverage report in coverage/lcov.info | |
- uses: codacy/codacy-coverage-reporter-action@master | |
with: | |
project-token: ${{ secrets.CODACY_REPOSITORY_TOKEN_FOR_COVERAGE }} | |
coverage-reports: coverage/lcov.info | |
release: | |
name: Release | |
needs: | |
- unit-tests | |
- integration-tests | |
- cypress-tests | |
- third-party-tests | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# to prevent "You're not authorized to push to this branch" | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- run: make release | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Create Docker tags | |
id: create_docker_tags | |
run: | | |
echo "tags=latest,$(git tag -l --sort=-v:refname | head -1 | cut -c 2-)" >> $GITHUB_OUTPUT | |
# from https://github.com/jerray/publish-docker-action/issues/11#issuecomment-607077257 | |
- name: Publish to Docker Hub registry | |
if: github.event_name == 'push' | |
uses: jerray/publish-docker-action@v1.0.5 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
tags: ${{ steps.create_docker_tags.outputs.tags }} | |
docker: | |
# To publish the Docker image from here, see https://github.com/openwhyd/openwhyd/pull/308/commits/1eacaa98885789642ba0073c9bb4d822021f0d95#diff-12a86cef0c4707531fdbabac3e38cb2aR36 | |
name: Docker tests | |
timeout-minutes: 5 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build and start services | |
run: docker-compose up --build --detach | |
# env: | |
# ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_TEST_APP_ID }} | |
# ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_TEST_API_KEY }} | |
- name: Init database for tests | |
run: make docker-seed | |
- name: Run integration tests | |
run: docker-compose exec -T --env MONGODB_URL web npm run test:integration | |
env: | |
MONGODB_URL: 'mongodb://mongo:27017/openwhyd_test' # needed by mongodb integration tests (user.repository.tests.js) | |
- name: Run API tests | |
run: docker-compose exec -T --env MONGODB_URL web npm run test:api:raw | |
env: | |
MONGODB_URL: 'mongodb://mongo:27017/openwhyd_test' | |
- name: Logs from docker-compose | |
if: ${{ always() }} # this step is useful to troubleshoot the execution of openwhyd when tests fail | |
run: docker-compose logs |