Deduplicate yarn.lock #68
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: | |
- develop | |
- main | |
pull_request: | |
branches: | |
- develop | |
- main | |
permissions: read-all | |
env: | |
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} | |
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }} | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
node_version: [18.20.1, 19.9.0, 20.12.1, 21.7.2] | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
id: node | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Send Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
Node.js: ${{ steps.node.outputs.node-version }} | |
status: in-progress | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn install --ignore-scripts | |
env: | |
NODE_ENV: development | |
- name: Build | |
run: yarn build | |
env: | |
NODE_ENV: production | |
- name: Update Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' && always() }} | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
Node.js: ${{ steps.node.outputs.node-version }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
node_version: [21.7.2] | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
id: node | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Send Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
Node.js: ${{ steps.node.outputs.node-version }} | |
ESLint issues: Checking... | |
Prettier issues: Checking... | |
status: in-progress | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn install --ignore-scripts | |
env: | |
NODE_ENV: development | |
- name: Lint using ESLint | |
run: yarn lint:eslint || true | |
- name: Output ESLint results | |
id: eslint | |
run: yarn ci:eslint || true | |
- name: Lint using Prettier | |
run: yarn lint:prettier || true | |
- name: Output Prettier results | |
id: prettier | |
run: yarn ci:prettier || true | |
- name: Check results | |
run: | | |
eslint_issues="${{ steps.eslint.outputs.issues }}" | |
prettier_issues="${{ steps.prettier.outputs.issues }}" | |
echo "Total ESLint issues: $eslint_issues" | |
echo "Total Prettier issues: $prettier_issues" | |
exit_code=1 | |
if [ "$eslint_issues" = '0' ] && [ "$prettier_issues" = '0' ]; then | |
exit_code=0 | |
fi | |
exit "$exit_code" | |
- name: Update Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' && always() }} | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
Node.js: ${{ steps.node.outputs.node-version }} | |
ESLint issues: ${{ steps.eslint.outputs.issues || 'Skipped' }} | |
Prettier issues: ${{ steps.prettier.outputs.issues || 'Skipped' }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
node_version: [18.20.1, 19.9.0, 20.12.1, 21.7.2] | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
id: node | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Send Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
Node.js: ${{ steps.node.outputs.node-version }} | |
Passed Jest tests: Testing... | |
Jest coverage: Testing... | |
status: in-progress | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn install --ignore-scripts | |
env: | |
NODE_ENV: development | |
- name: Test using Jest | |
run: yarn test || true | |
- name: Output Jest results | |
id: jest | |
run: | | |
yarn ci:test | |
echo "coverage=$(jq -crM .total.lines.pct ./coverage/coverage-summary.json)%" >> $GITHUB_OUTPUT | |
- name: Check results | |
run: | | |
jest_coverage="${{ steps.jest.outputs.coverage }}" | |
jest_passed="${{ steps.jest.outputs.passed }}" | |
jest_total="${{ steps.jest.outputs.total }}" | |
echo "Passed Jest tests: $jest_passed" | |
echo "Total Jest tests: $jest_total" | |
echo "Jest coverage: $jest_coverage" | |
exit_code=1 | |
if [ "$jest_passed" = "$jest_total" ]; then | |
exit_code=0 | |
fi | |
exit "$exit_code" | |
- name: Send Codecov report | |
if: ${{ !env.ACT && github.event_name != 'pull_request' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Send Code Climate report | |
uses: paambaati/[email protected] | |
if: ${{ !env.ACT && github.event_name != 'pull_request' }} | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
- name: Output additional Slack fields | |
id: slack-fields | |
run: | | |
jest_passed="${{ steps.jest.outputs.passed }}" | |
jest_total="${{ steps.jest.outputs.total }}" | |
passed_jest_tests='Skipped' | |
if [ "$jest_passed" != '' ] && [ "$jest_total" != '' ] && [ "$jest_passed" != 'null' ] && [ "$jest_total" != 'null' ]; then | |
passed_jest_tests="$jest_passed / $jest_total" | |
fi | |
echo "passed-jest-tests=$passed_jest_tests" >> $GITHUB_OUTPUT | |
- name: Update Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' && always() }} | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
Node.js: ${{ steps.node.outputs.node-version }} | |
Passed Jest tests: ${{ steps.slack-fields.outputs.passed-jest-tests }} | |
Jest coverage: ${{ steps.jest.outputs.coverage || 'Skipped' }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} |