Direct PR Test #417
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: Build and Compile Extractor Pack | |
| on: | |
| pull_request: | |
| branches: ["main", "develop"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: read | |
| pull-requests: read | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| test-folders: ["library-tests", "queries-tests"] | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: "Check for changes" | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| id: extractor-changes | |
| with: | |
| filters: | | |
| src: | |
| - 'extractor/**' | |
| - 'rust-toolchain.toml' | |
| - 'Cargo.*' | |
| - name: "Download Extracter" | |
| if: steps.extractor-changes.outputs.src == 'false' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -e | |
| gh release list -L 1 -R "advanced-security/codeql-extractor-iac" | |
| gh release download \ | |
| -R "advanced-security/codeql-extractor-iac" \ | |
| --clobber \ | |
| --pattern 'extractor-iac.tar.gz' | |
| tar -zxf extractor-iac.tar.gz | |
| chmod +x extractor-pack/tools/*.sh | |
| chmod +x extractor-pack/tools/**/* | |
| - uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable | |
| if: steps.extractor-changes.outputs.src == 'true' | |
| - name: "Build Extractor" | |
| if: steps.extractor-changes.outputs.src == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -e | |
| gh extensions install github/gh-codeql | |
| gh codeql set-version latest | |
| ./scripts/create-extractor-pack.sh | |
| gh codeql resolve languages --format=json --search-path ./extractor-pack | |
| - name: "Run Tests" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| ./scripts/run-tests.sh "ql/test/${{ matrix.test-folders }}" | |
| # scanning: | |
| # runs-on: ubuntu-latest | |
| # needs: [tests] | |
| # strategy: | |
| # matrix: | |
| # # project: ["hashicorp/terraform-guides", "akamai/terraform-examples", "aws-samples/aws-sam-terraform-examples"] | |
| # project: [] | |
| # steps: | |
| # - name: "Checkout" | |
| # uses: actions/checkout@v5 | |
| # with: | |
| # submodules: true | |
| # - name: "Checkout" | |
| # uses: actions/checkout@v5 | |
| # with: | |
| # repository: ${{ matrix.project }} | |
| # path: project | |
| # - name: "Check for changes" | |
| # uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| # id: extractor-changes | |
| # with: | |
| # filters: | | |
| # src: | |
| # - 'extractor/**' | |
| # - 'rust-toolchain.toml' | |
| # - 'Cargo.*' | |
| # - name: "Download Extracter" | |
| # if: steps.extractor-changes.outputs.src == 'false' | |
| # env: | |
| # GH_TOKEN: ${{ github.token }} | |
| # run: | | |
| # set -e | |
| # gh release list -L 1 -R "advanced-security/codeql-extractor-iac" | |
| # gh release download \ | |
| # -R "advanced-security/codeql-extractor-iac" \ | |
| # --clobber \ | |
| # --pattern 'extractor-iac.tar.gz' | |
| # tar -zxf extractor-iac.tar.gz | |
| # - uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable | |
| # if: steps.extractor-changes.outputs.src == 'true' | |
| # - name: "Build Extractor" | |
| # if: steps.extractor-changes.outputs.src == 'true' | |
| # env: | |
| # GH_TOKEN: ${{ github.token }} | |
| # run: | | |
| # set -e | |
| # gh extensions install github/gh-codeql | |
| # gh codeql set-version latest | |
| # ./scripts/create-extractor-pack.sh | |
| # gh codeql resolve languages --format=json --search-path ./extractor-pack | |
| # - name: "Run CodeQL Analysis" | |
| # env: | |
| # GH_TOKEN: ${{ github.token }} | |
| # PROJECT_REPO: ${{ matrix.project }} | |
| # run: | | |
| # set -e | |
| # gh extensions install github/gh-codeql | |
| # gh codeql set-version latest | |
| # gh codeql database create --language=iac --source-root=./project --search-path ./extractor-pack iac-db | |
| # gh codeql database analyze --search-path ./extractor-pack --format sarif-latest --output="iac-${PROJECT_REPO}.sarif" iac-db ./ql/src | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| id: changes | |
| with: | |
| filters: | | |
| src: | |
| - '**.md' | |
| # lint markdown | |
| - name: "Lint Markdown" | |
| if: steps.changes.outputs.src == 'true' | |
| run: | | |
| npm install -g markdownlint-cli | |
| markdownlint '**.md' --ignore node_modules --disable MD013 |