qiwi/inside-out-promise

View on GitHub
.github/workflows/ci.yaml

Summary

Maintainability
Test Coverage
# This is a Github Workflow that runs tests on any push or pull request.
# If the tests pass and this is a push to the master branch it also runs Semantic Release.
name: CI
on: [push, pull_request]

jobs:
  test_push:
    if: github.event_name == 'push'
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - uses: actions/setup-node@v3
        with:
          node-version: 18

      - name: Install deps
        run: yarn

      - name: Build
        run: yarn build

      - name: Test
        run: yarn test

  test_pr:
    if: github.event_name == 'pull_request'
    strategy:
      matrix:
        os: [ ubuntu-22.04 ]
        node-version: [ 18 ]
    name: Test (Node v${{ matrix.node-version }}, OS ${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install deps
        run: yarn

      - name: Build
        run: yarn build

      - name: Full test
        if: matrix.node-version == '18' && matrix.os == 'ubuntu-22.04'
        run: yarn test

  release:
    name: Release
    if: github.event_name == 'push' && github.ref == 'refs/heads/master'
    needs: [test_push]
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          ref: master

      - uses: actions/setup-node@v3
        with:
          node-version: 18

      - name: Install deps
        run: yarn

      - name: Build
        run: yarn build

      - name: Release
        env:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          GH_USER: 'qiwibot'
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
          GIT_AUTHOR_EMAIL: 'opensource@qiwi.com'
          GIT_COMMITTER_EMAIL: 'opensource@qiwi.com'
          GIT_AUTHOR_NAME: '@qiwibot'
          GIT_COMMITTER_NAME: '@qiwibot'
          YARN_ENABLE_IMMUTABLE_INSTALLS: false
        run: npx -p @qiwi/semrel-toolkit semrel -e @qiwi/semrel-config