Skip to content

Merge pull request #91 from simonihmig/exclude-tests-flag #359

Merge pull request #91 from simonihmig/exclude-tests-flag

Merge pull request #91 from simonihmig/exclude-tests-flag #359

Workflow file for this run

name: "CI"
on:
pull_request:
push:
# filtering branches here prevents duplicate builds from pull_request and push
branches:
- main
- master
env:
CI: true
jobs:
install_dependencies:
name: Install
runs-on: ubuntu-latest
outputs:
fixtures-matrix: ${{ steps.find_fixtures.outputs.fixtures }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pnpm
- id: find_fixtures
name: "find fixture tests"
run: |
test_info=$(pnpm run --silent dev list-fixtures)
echo "fixtures=$test_info" >> $GITHUB_OUTPUT
working-directory: ./tests
linting_and_formatting:
name: Lint JS
runs-on: ubuntu-latest
needs: [install_dependencies]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pnpm
- name: Lints
run: pnpm lint
types_library:
name: "Types: Library"
runs-on: ubuntu-latest
timeout-minutes: 2
needs: [install_dependencies]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pnpm
- run: tsc --build --clean && tsc --build
continue-on-error: true
working-directory: cli
types_tests:
name: "Types: Tests"
runs-on: ubuntu-latest
timeout-minutes: 2
needs: [install_dependencies]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pnpm
- run: tsc --build --clean && tsc --build
continue-on-error: true
working-directory: tests
fixture_tests:
name: "Test: ${{ matrix.fixtures.name }}"
runs-on: ubuntu-latest
needs: [install_dependencies]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.install_dependencies.outputs.fixtures-matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pnpm
- name: Tests
working-directory: "tests"
run: |
pnpm vitest --testNamePattern "${{ matrix.fixtures.name }}"
# https://github.com/changesets/action
release:
name: Release
timeout-minutes: 5
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [fixture_tests]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: ./.github/actions/pnpm
- 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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}