Skip to content

Commit

Permalink
Test GitHub Workflows with Snyk and Unit Test Improvements (#2)
Browse files Browse the repository at this point in the history
* Testing unit test cases

* Changing the runners

* Changes to the release workflow
  • Loading branch information
kishore7snehil authored Dec 6, 2024
1 parent 99408b9 commit cd8352b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
release:
#if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
runs-on:
labels: ubuntu-22.04-2cpu-8ram-75ssd
labels: ubuntu-latest
environment: release

steps:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release-auth0-acul-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ name: Create npm and GitHub Release For auth0-acul-js
on:
# Trigger this workflow when a branch like "release/auth0-acul-js/v*" is pushed
push:
branches:
- 'release/auth0-acul-js/v*'

pull_request:
branches:
- 'release/auth0-acul-js/v*' # Ensure the branch matches this pattern
types:
- open
- closed # Trigger when a PR is closed (merged)
workflow_dispatch:
permissions:
contents: write
Expand All @@ -19,6 +20,7 @@ permissions:

jobs:
release:
if: (github.event.pull_request.merged == true) && startsWith(github.event.pull_request.base.ref, 'release/auth0-acul-js/v')
uses: ./.github/workflows/npm-release.yml
with:
node-version: 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
semgrep:
name: Scan
runs-on: ubuntu-22.04-2cpu-8ram-75ssd
runs-on: ubuntu-latest
container:
image: returntocorp/semgrep
# Skip any PR created by dependabot to avoid permission issues
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- synchronize
push:
branches:
- main
- master
- beta
schedule:
- cron: '30 0 1,15 * *'
Expand All @@ -26,7 +26,7 @@ jobs:
check:

name: Check for Vulnerabilities
runs-on: ubuntu-22.04-2cpu-8ram-75ssd
runs-on: ubuntu-latest

steps:
- if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group'
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'packages/ul-react/**'
push:
branches:
- main
- master
paths:
- 'packages/auth0-acul-js/**'
- 'packages/ul-react-component/**'
Expand All @@ -29,9 +29,9 @@ env:
jobs:
determine-package:
name: Determine modified files
runs-on: ubuntu-22.04-2cpu-8ram-75ssd
runs-on: ubuntu-latest
outputs:
ul-javascript-changed: ${{ steps.determine_package.outputs.ul-javascript-changed }}
auth0-acul-js-changed: ${{ steps.determine_package.outputs.auth0-acul-js-changed }}
ul-react-component-changed: ${{ steps.determine_package.outputs.ul-react-component-changed }}
ul-react-changed: ${{ steps.determine_package.outputs.ul-react-changed }}

Expand All @@ -52,28 +52,28 @@ jobs:
cat files.json
jq -r '.[].filename' files.json > changed_files.txt
cat changed_files.txt
ul_javascript_changed=false
auth0_acul_js_changed=false
ul_react_component_changed=false
ul_react_changed=false
if grep -q "packages/auth0-acul-js/" changed_files.txt; then
ul_javascript_changed=true
auth0_acul_js_changed=true
fi
if grep -q "packages/ul-react-component/" changed_files.txt; then
ul_react_component_changed=true
fi
if grep -q "packages/ul-react/" changed_files.txt; then
ul_react_changed=true
fi
echo "ul-javascript-changed=$ul_javascript_changed" >> $GITHUB_OUTPUT
echo "auth0-acul-js-changed=$auth0_acul_js_changed" >> $GITHUB_OUTPUT
echo "ul-react-component-changed=$ul_react_component_changed" >> $GITHUB_OUTPUT
echo "ul-react-changed=$ul_react_changed" >> $GITHUB_OUTPUT
ul-javascript-build:
auth0-acul-js-build:
needs: determine-package
if: ${{ needs.determine-package.outputs.ul-javascript-changed == 'true' }}
name: Build and Test ul-javascript
runs-on: ubuntu-22.04-2cpu-8ram-75ssd
if: ${{ needs.determine-package.outputs.auth0-acul-js-changed == 'true' }}
name: Build and Test auth0-acul-js
runs-on: ubuntu-latest

steps:
- name: Checkout code
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
needs: determine-package
if: ${{ needs.determine-package.outputs.ul-react-component-changed == 'true' }}
name: Build and Test ul-react-component
runs-on: ubuntu-22.04-2cpu-8ram-75ssd
runs-on: ubuntu-latest

steps:
- name: Checkout code
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
notify:
needs:
- ul-javascript-build
- auth0-acul-js-build
- ul-react-component-build
- ul-react-build
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion packages/auth0-acul-js/.version
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

v1.0.1

0 comments on commit cd8352b

Please sign in to comment.