refactor(ts)!: use @actions/exec instead of bash script for OPA commands, allow testing entire directory vs file by file #69
Workflow file for this run
This file contains hidden or 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: Tests | |
| on: pull_request | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| test-typescript: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run build --if-present | |
| - run: npm test | |
| - name: Jest Coverage Report | |
| uses: ArtiomTr/jest-coverage-report-action@c026e98ae079f4b0b027252c8e957f5ebd420610 # v2.3.0 | |
| test-action-on-itself: | |
| name: Test the GitHub Action on itself | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4 | |
| - name: Test Local Action (Individual File Mode) | |
| id: test-action-opa-files | |
| uses: ./ | |
| with: | |
| path: ./examples | |
| test_mode: file | |
| report_untested_files: true | |
| pr_comment_title: Below is the Action testing on itself with this PR's source code against policies in `/examples` file by file. Confirm it is as expected. | |
| - name: Test Local Action (Directory Package Mode) | |
| id: test-action-opa-package | |
| uses: ./ | |
| with: | |
| path: ./examples | |
| test_mode: directory | |
| report_untested_files: true | |
| pr_comment_title: Below is the Action testing on itself with this PR's source code against `/spacelift_policies` entire package directory. Confirm it is as expected. |