Run RTK publish CI examples on built artifact #56
Workflow file for this run
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: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
name: Lint, Test, Build & Pack on Node ${{ matrix.node }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: ['16.x'] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Use Node ${{ matrix.node }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'yarn' | |
- name: Install deps | |
run: yarn install | |
# Read existing version, reuse that, add a Git short hash | |
- name: Set build version to Git commit | |
run: node scripts/writeGitVersion.js $(git rev-parse --short HEAD) | |
- name: Check updated version | |
run: jq .version package.json | |
- name: Run linter | |
run: yarn lint | |
- name: Run tests | |
run: yarn test | |
- name: Pack | |
run: yarn pack | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: package | |
path: packages/toolkit/package.tgz | |
test-types: | |
name: Test Types with TypeScript ${{ matrix.ts }} | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node: ['16.x'] | |
ts: ['4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9', '5.0'] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Use node ${{ matrix.node }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'yarn' | |
- name: Install deps | |
run: yarn install | |
- name: Install TypeScript ${{ matrix.ts }} | |
run: yarn add typescript@${{ matrix.ts }} | |
- name: Test types | |
run: | | |
yarn tsc --version | |
yarn test:typescript | |
test-published-artifact: | |
name: Test Published Artifact ${{ matrix.example }} | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node: ['16.x'] | |
example: [ | |
# 'cra4', | |
'cra5', | |
# 'next', | |
'vite' | |
# 'node-standard', | |
# 'node-esm', | |
# 'are-the-types-wrong', | |
] | |
defaults: | |
run: | |
working-directory: ./examples/publish-ci/${{ matrix.example }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Use node ${{ matrix.node }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'yarn' | |
- name: Clone RTK repo | |
run: > | |
git clone https://github.com/reduxjs/redux-toolkit | |
cd redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
- name: Install deps | |
run: yarn install | |
- uses: actions/download-artifact@v2 | |
with: | |
name: package | |
path: ./examples/publish-ci/${{ matrix.example }} | |
- name: Check folder contents | |
run: ls -l . | |
- name: Install Redux-Thunk build artifact | |
run: yarn add ./package.tgz | |
- name: Show installed package versions | |
run: > | |
yarn info redux-thunk | |
yarn why redux-thunk | |
- name: Build example | |
run: yarn build | |
- name: Run test step | |
run: yarn test |