Merge pull request #7 from ektotv/types-workaround-for-esm #22
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: {} | |
concurrency: | |
group: ci-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
env: | |
CI: true | |
dist: dist | |
jobs: | |
install_dependencies: | |
name: Install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: NullVoxPopuli/action-setup-pnpm@v2 | |
typecheck: | |
name: "${{ matrix.typescript-scenario }}" | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
needs: [build] | |
continue-on-error: true | |
strategy: | |
fail-fast: true | |
matrix: | |
typescript-scenario: | |
- [email protected] | |
- [email protected] # project version | |
- typescript@latest | |
- typescript@next | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: NullVoxPopuli/action-setup-pnpm@v2 | |
- uses: ./.github/actions/download-built-package | |
- name: "Change TS to ${{ matrix.typescript-scenario }}" | |
run: "pnpm add --save-dev ${{ matrix.typescript-scenario}}" | |
working-directory: ./ | |
- name: "Type checking" | |
run: pnpm lint; | |
build: | |
name: Build | |
needs: [install_dependencies] | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: NullVoxPopuli/action-setup-pnpm@v2 | |
- uses: ./.github/actions/assert-build | |
tests: | |
name: Tests | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: NullVoxPopuli/action-setup-pnpm@v2 | |
- run: pnpm run test | |
- name: Get Coverage for badge | |
run: | | |
# var SUMMARY = [ | |
# '', | |
# '=============================== Coverage summary ===============================', | |
# 'Statements : 32.5% ( 39/120 )', | |
# 'Branches : 38.89% ( 21/54 )', | |
# 'Functions : 21.74% ( 5/23 )', | |
# 'Lines : 31.93% ( 38/119 )', | |
# '================================================================================', | |
# '' | |
# ]; | |
# SUMMARY = SUMMARY.split('\n')[5]; // 'Lines : 31.93% ( 38/119 )' | |
# SUMMARY = SUMMARY.split(':')[1].split('(')[0].trim(); // '31.93%' | |
SUMMARY="$(pnpm run test:ci | tail -2 | head -1)" | |
TOKENS=($SUMMARY) | |
# process.env.COVERAGE = '31.93%'; | |
echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV | |
# var REF = 'refs/pull/27/merge.json'; | |
REF=${{ github.ref }} | |
# console.log('github.ref: ' + REF); | |
echo "github.ref: $REF" | |
# var PATHS = REF.split('/'); | |
IFS='/' read -ra PATHS <<< "$REF" | |
# var BRANCH_NAME = PATHS[1] + PATHS[2]; | |
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}" | |
# console.log(BRANCH_NAME); // 'pull_27' | |
echo $BRANCH_NAME | |
# process.env.BRANCH = 'pull_27'; | |
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV | |
- name: Create the Badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 7c8deb6342792baafac8834185e96476 | |
filename: iptv_playlist_coverage.json | |
label: Coverage | |
message: ${{ env.COVERAGE }} | |
color: green | |
namedLogo: vitest | |
# https://github.com/changesets/action | |
release: | |
name: Release | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- tests | |
- typecheck | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- uses: NullVoxPopuli/action-setup-pnpm@v2 | |
- uses: ./.github/actions/download-built-package | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
# This expects you to have a script called release which does a build for your packages and calls changeset publish | |
publish: pnpm release | |
title: "Release Preview" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |