|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [master] |
| 6 | + |
| 7 | +jobs: |
| 8 | + lint_check: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + with: |
| 13 | + ref: ${{ github.head_ref }} |
| 14 | + |
| 15 | + - uses: ./.github/actions/ci-common-setup |
| 16 | + |
| 17 | + - name: Lint check |
| 18 | + run: pnpm exec eslint --cache |
| 19 | + |
| 20 | + prettier_check: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + ref: ${{ github.head_ref }} |
| 26 | + |
| 27 | + - uses: ./.github/actions/ci-common-setup |
| 28 | + |
| 29 | + - name: Prettier check |
| 30 | + run: pnpm exec prettier --check "./{src,spec}/**/*.{ts,tsx,js,mjs,jsx}" |
| 31 | + |
| 32 | + ts_build_test: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + ref: ${{ github.head_ref }} |
| 38 | + |
| 39 | + - uses: ./.github/actions/ci-common-setup |
| 40 | + |
| 41 | + - name: TypeScript test build |
| 42 | + run: pnpm run build-check |
| 43 | + |
| 44 | + run_tests: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + ref: ${{ github.head_ref }} |
| 50 | + |
| 51 | + - uses: ./.github/actions/ci-common-setup |
| 52 | + |
| 53 | + - name: Get "name" from package.json |
| 54 | + id: get-name |
| 55 | + run: | |
| 56 | + echo "package_name=$(cat ./package.json | jq -r '.name')" >> $GITHUB_OUTPUT |
| 57 | +
|
| 58 | + - name: Build and pack library locally |
| 59 | + id: pkg-pack |
| 60 | + run: | |
| 61 | + pnpm pack |
| 62 | +
|
| 63 | + - name: Install locally-packaged library |
| 64 | + run: | |
| 65 | + PACKAGE_FILENAME=$(ls ${{ steps.get-name.outputs.package_name }}-*.tgz) |
| 66 | + pnpm i packaged-react-async-iterators@file:./$PACKAGE_FILENAME |
| 67 | +
|
| 68 | + - name: Run tests against packaged library code |
| 69 | + run: | |
| 70 | + [[ -e ./src ]] && mv ./src ./src-ignored-for-packaged-testing |
| 71 | + echo 'export * from "packaged-react-async-iterators";' > ./spec/libEntrypoint.ts |
| 72 | + pnpm test |
| 73 | + [[ -e ./src-ignored-for-packaged-testing ]] && mv ./src-ignored-for-packaged-testing ./src |
| 74 | +
|
| 75 | + run_type_check_on_tests: |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v4 |
| 79 | + with: |
| 80 | + ref: ${{ github.head_ref }} |
| 81 | + |
| 82 | + - uses: ./.github/actions/ci-common-setup |
| 83 | + |
| 84 | + - name: Get "name" from package.json |
| 85 | + id: get-name |
| 86 | + run: | |
| 87 | + echo "package_name=$(cat ./package.json | jq -r '.name')" >> $GITHUB_OUTPUT |
| 88 | +
|
| 89 | + - name: Build and pack library locally |
| 90 | + id: pkg-pack |
| 91 | + run: | |
| 92 | + pnpm pack |
| 93 | +
|
| 94 | + - name: Install locally-packaged library |
| 95 | + run: | |
| 96 | + PACKAGE_FILENAME=$(ls ${{ steps.get-name.outputs.package_name }}-*.tgz) |
| 97 | + pnpm i packaged-react-async-iterators@file:./$PACKAGE_FILENAME |
| 98 | +
|
| 99 | + - name: Type-check tests code |
| 100 | + run: | |
| 101 | + [[ -e ./src ]] && mv ./src ./src-ignored-for-packaged-testing |
| 102 | + echo 'export * from "packaged-react-async-iterators";' > ./spec/libEntrypoint.ts |
| 103 | + pnpm run test-typings-check |
| 104 | + [[ -e ./src-ignored-for-packaged-testing ]] && mv ./src-ignored-for-packaged-testing ./src |
0 commit comments