feat(CLI): Improve instructions for running a recipe #3768
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: Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
name: Run unit tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
db_required: true | |
- os: windows-latest | |
db_required: false | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install latest docker-compose | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo curl -SL https://github.com/docker/compose/releases/download/v2.24.7/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose | |
- name: Install modules | |
uses: pnpm/action-setup@v4 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Start database | |
if: matrix.db_required | |
run: | | |
docker-compose up -d database | |
- name: Apply database migrations | |
if: matrix.db_required | |
run: pnpm --filter @codemod-com/backend db:migrate:apply | |
env: | |
DATABASE_URI: ${{ secrets.DATABASE_URI }} | |
- name: Build necessary packages | |
run: pnpm build --filter codemod --filter @codemod-com/jscodeshift-utils | |
- name: Run unit tests | |
run: | | |
if [[ ${{ matrix.os }} == "windows-latest" ]]; then | |
pnpm test:win | |
else | |
pnpm build --filter @codemod-com/backend && pnpm test | |
fi | |
shell: bash | |
env: | |
DATABASE_URI: ${{ secrets.DATABASE_URI }} | |
- name: Close database | |
if: matrix.db_required | |
run: docker-compose down |