|
| 1 | +name: test |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + paths-ignore: |
| 7 | + - README.md |
| 8 | + pull_request_target: |
| 9 | + types: |
| 10 | + - labeled |
| 11 | + - unlabeled |
| 12 | + branches: |
| 13 | + - main |
| 14 | + paths-ignore: |
| 15 | + - README.md |
| 16 | + |
| 17 | +jobs: |
| 18 | + check-perms: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Get User Permission |
| 22 | + id: checkAccess |
| 23 | + uses: actions-cool/check-user-permission@v2 |
| 24 | + with: |
| 25 | + require: write |
| 26 | + username: ${{ github.triggering_actor }} |
| 27 | + env: |
| 28 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + - name: Check User Permission |
| 30 | + if: steps.checkAccess.outputs.require-result == 'false' |
| 31 | + run: | |
| 32 | + echo "${{ github.triggering_actor }} does not have permissions on this repo." |
| 33 | + echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" |
| 34 | + echo "Job originally triggered by ${{ github.actor }}" |
| 35 | + exit 1 |
| 36 | +
|
| 37 | + test-linux: |
| 38 | + needs: check-perms |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + fetch-depth: 1 |
| 44 | + ref: ${{ github.event.pull_request.head.sha }} |
| 45 | + - uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: 21 |
| 48 | + - name: Install gptscript |
| 49 | + run: | |
| 50 | + curl https://get.gptscript.ai/releases/default_linux_amd64_v1/gptscript -o ./gptscriptexe |
| 51 | + chmod +x ./gptscriptexe |
| 52 | + - name: Install dependencies |
| 53 | + run: npm install |
| 54 | + - name: Run Tests |
| 55 | + env: |
| 56 | + GPTSCRIPT_BIN: ./gptscriptexe |
| 57 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 58 | + NODE_GPTSCRIPT_SKIP_INSTALL_BINARY: true |
| 59 | + run: npm test |
| 60 | + |
| 61 | + test-windows: |
| 62 | + needs: check-perms |
| 63 | + runs-on: windows-latest |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + fetch-depth: 1 |
| 68 | + ref: ${{ github.event.pull_request.head.sha }} |
| 69 | + - uses: actions/setup-node@v4 |
| 70 | + with: |
| 71 | + node-version: 21 |
| 72 | + - name: Install gptscript |
| 73 | + run: | |
| 74 | + curl https://get.gptscript.ai/releases/default_windows_amd64_v1/gptscript.exe -o gptscript.exe |
| 75 | + - name: Install dependencies |
| 76 | + run: npm install |
| 77 | + - name: Run Tests |
| 78 | + env: |
| 79 | + GPTSCRIPT_BIN: .\gptscript.exe |
| 80 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 81 | + NODE_GPTSCRIPT_SKIP_INSTALL_BINARY: true |
| 82 | + run: npm test |
0 commit comments