Update Apollo GraphQL packages #757
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: Tests CI | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "14.15.4" | |
- name: Use .npmrc | |
uses: bduff9/[email protected] | |
with: | |
dot-npmrc: ${{ secrets.DOT_NPMRC }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Validate code is well-formatted | |
run: npm run validate | |
- name: Validate tests are successful | |
run: npm run test:ci | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Analyze the code | |
id: scc | |
uses: iryanbell/[email protected] | |
with: | |
args: ${{ env.workspace }} | |
- uses: returntocorp/semgrep-action@v1 | |
with: | |
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }} | |
publishDeployment: 600 | |
- name: Set environment variables | |
run: | | |
case "${GITHUB_REF}" in | |
"refs/heads/main") DEPLOY_ENV=production ;; | |
"refs/heads/develop") DEPLOY_ENV=development ;; | |
*) DEPLOY_ENV= ;; | |
esac | |
echo "DEPLOY_ENV=${DEPLOY_ENV}" | |
echo "DEPLOY_ENV=${DEPLOY_ENV}" >> $GITHUB_ENV | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: aswnn | |
SENTRY_PROJECT: movies-fe | |
with: | |
environment: ${{ env.DEPLOY_ENV }} | |
- name: Tests ✅ | |
if: ${{ success() }} | |
run: | | |
curl --request POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ | |
"context": "tests", | |
"state": "success", | |
"description": "Tests passed", | |
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' | |
- name: Tests 🚨 | |
if: ${{ failure() }} | |
run: | | |
curl --request POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ | |
"context": "tests", | |
"state": "failure", | |
"description": "Tests failed", | |
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' | |
- name: Notify Slack | |
if: always() | |
uses: kpritam/slack-job-status-action@v1 | |
with: | |
job-status: ${{ job.status }} | |
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
channel: movies-fe |