Skip to content

Commit

Permalink
ci: split workflow between test and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Nov 21, 2024
1 parent cb751a0 commit 5cec09e
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 56 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/nodejs.yml

This file was deleted.

117 changes: 117 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Test
on:
push:
pull_request:
jobs:
is_release:
runs-on: ubuntu-latest
outputs:
type: ${{ steps.get_type.outputs.type }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: get_type
run: echo $( git tag --points-at HEAD | grep -q -e '^.*@.*$' && echo 'type=::release::' || echo "type=::norelease::" ) >> "$GITHUB_OUTPUT"
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
test_legacy:
needs: [is_release]
if: ${{ needs.is_release.outputs.type == '::norelease::' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: |
cwd=`pwd`
for pkg in packages/*/package.json; do
cd $cwd/`dirname $pkg`
npm install
npm run test:legacy;
done
# - run: |
# echo 'Test csv generate'
# cwd=`pwd`
# cd $cwd/packages/csv-generate
# npm install
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test stream transform'
# cwd=`pwd`
# cd $cwd/packages/stream-transform
# npm install
# npm link csv-generate
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test csv parse'
# cwd=`pwd`
# cd $cwd/packages/csv-parse
# npm install
# npm link csv-generate
# npm link stream-transform
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test csv stringify'
# cwd=`pwd`
# cd $cwd/packages/csv-stringify
# npm install
# npm link csv-generate
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test csv'
# cwd=`pwd`
# cd $cwd/packages/csv
# npm install
# npm link csv-generate
# npm link csv-parse
# npm link csv-stringify
# npm link stream-transform
# npm run test:legacy
# npm link
# cd $pwd
publish:
needs: [is_release, test]
if: ${{ needs.is_release.outputs.type == '::release::' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 5cec09e

Please sign in to comment.