-
Notifications
You must be signed in to change notification settings - Fork 6
feat: github action to run otp provider unit tests #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
- name: Cache Node dependencies | ||
uses: actions/cache@v4 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: ${{ runner.os }}-yarn- | ||
|
||
- name: Install asdf requirements | ||
run: | | ||
sudo apt-get install -y libssl-dev libreadline-dev uuid-dev | ||
|
||
- name: Install asdf | ||
uses: asdf-vm/actions/setup@v3 | ||
- name: Cache asdf tools | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
/home/runner/.asdf | ||
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }} | ||
|
||
- name: Install asdf | ||
uses: asdf-vm/actions/install@v3 | ||
|
||
- name: Install app specific asdf plugins | ||
run: | | ||
cat .tool-versions | cut -f 1 -d ' ' | xargs -n 1 asdf plugin-add || true | ||
asdf plugin-update --all | ||
asdf install | ||
asdf reshim | ||
working-directory: ./docker/otp-provider | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
working-directory: ./docker/otp-provider | ||
|
||
- name: Setup postgres | ||
env: | ||
PGUSER: postgres | ||
run: | | ||
pg_ctl start | ||
createdb runner || true | ||
chmod +x ./db-setup.sh | ||
./db-setup.sh otp_test | ||
working-directory: ./docker/otp-provider/.bin | ||
|
||
- name: Run unit tests | ||
run: | | ||
yarn test | ||
working-directory: ./docker/otp-provider |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 days ago
To fix the issue, we need to add a permissions
block to the workflow. This block should specify the minimum permissions required for the workflow to function correctly. Based on the tasks performed in the workflow, the contents: read
permission is sufficient, as the workflow does not modify repository contents or require write access.
The permissions
block can be added at the root level of the workflow file to apply to all jobs, or it can be added specifically to the otp-provider-test
job. In this case, adding it at the root level is more concise and ensures consistency across all jobs.
-
Copy modified lines R11-R13
@@ -10,2 +10,5 @@ | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: |
No description provided.