|
| 1 | +name: PR Checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + pr-checks: |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 14 | + name: PR Checks |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + env: |
| 17 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Install extension |
| 23 | + shell: bash |
| 24 | + run: | |
| 25 | + gh extensions install . |
| 26 | +
|
| 27 | + - name: Check basic functionality |
| 28 | + working-directory: test-resources |
| 29 | + shell: bash |
| 30 | + run: | |
| 31 | + gh codeql database create -l cpp -s test-repo -c "gcc -o main main.c" test-db |
| 32 | + gh codeql pack install test-pack |
| 33 | + gh codeql database analyze --format=sarif-latest --output=out.sarif test-db test-pack/allExpressions.ql |
| 34 | + RESULTS=`jq '.runs[0].results | length' out.sarif` |
| 35 | + if [[ $RESULTS != 1 ]]; then |
| 36 | + echo "::error::Invalid number of results from test query, expected 1 but got $RESULTS" |
| 37 | + exit 1 |
| 38 | + fi |
| 39 | +
|
| 40 | + - name: Check version pinning |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + gh codeql set-version v2.5.9 |
| 44 | + VERSION=`gh codeql version --format json | jq -r '.version'` |
| 45 | + if [[ $VERSION != "2.5.9" ]]; then |
| 46 | + echo "::error::Expected version 2.5.9 but got $VERSION" |
| 47 | + exit 1 |
| 48 | + fi |
| 49 | +
|
| 50 | + - name: Check version unpinning |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + gh codeql set-version latest |
| 54 | + VERSION=`gh codeql version --format json | jq -r '.version'` |
| 55 | + if [[ $VERSION == "2.5.9" ]]; then |
| 56 | + echo "::error::Expected latest version but got 2.5.9" |
| 57 | + exit 1 |
| 58 | + fi |
0 commit comments