[major] [TestOps] wathching all tests in realtime (#50) #238
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: NodeJS with Webpack | |
permissions: write-all | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: volta-cli/action@v4 | |
- name: Install | |
run: npm ci | |
- name: Versions | |
run: | | |
node --version | |
npm --version | |
- name: Lint | |
run: npm run lint | |
- name: Build | |
run: npm run build:all | |
- name: Test | |
run: npm run test:cov | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: ./reports/coverage-full-total/lcov-report/ | |
- name: Monitor coverage | |
continue-on-error: true | |
uses: danhunsaker/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
clover-file: ./reports/coverage-full-total/clover.xml | |
- name: Publish Jest Test Report | |
uses: mikepenz/action-junit-report@v3 | |
if: success() || failure() # always run even if the previous step fails | |
with: | |
report_paths: '**/reports/jest/*.xml' | |
check_name: 'Jest Test Report' | |
detailed_summary: true | |
- name: Publish | |
if: success() | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
branch=${{ github.ref }} | |
echo "Branch: $branch" | |
gitmsg="${{ github.event.commits[0].message }}" | |
echo "Commit: $gitmsg" | |
if [[ "$gitmsg" =~ "[patch]" ]]; then | |
echo "publish patch" | |
npm run publish:patch | |
git push --tags | |
exit 0 | |
fi | |
if [[ "$gitmsg" =~ "[fix]" ]]; then | |
echo "publish patch" | |
npm run publish:patch | |
git push --tags | |
exit 0 | |
fi | |
if [[ "$gitmsg" =~ "[minor]" ]]; then | |
echo "publish minor" | |
npm run publish:minor | |
git push --tags | |
exit 0 | |
fi | |
if [[ "$gitmsg" =~ "[major]" ]]; then | |
echo "publish major" | |
npm run publish:major | |
git push --tags | |
exit 0 | |
fi | |
# echo "publishing alpha, for other commit message should contain [minor], [major] or [patch]/[fix]" | |
# npm run publish:alpha | |
# git push --tags | |