From 679aac1b20947026d7575616383725ec2d5928cf Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 28 Jul 2023 11:44:41 +0100 Subject: [PATCH] Use platform specific bundles in PR checks --- .github/actions/prepare-test/action.yml | 24 +++++++++++++++++------ .github/workflows/__test-local-codeql.yml | 2 +- pr-checks/checks/test-local-codeql.yml | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/actions/prepare-test/action.yml b/.github/actions/prepare-test/action.yml index f93d102116..a6134cc706 100644 --- a/.github/actions/prepare-test/action.yml +++ b/.github/actions/prepare-test/action.yml @@ -23,15 +23,27 @@ runs: shell: bash run: | set -e # Fail this Action if `gh release list` fails. + + if [[ "$RUNNER_OS" == "Linux" ]]; then + artifact_name="codeql-bundle-linux64.tar.gz" + elif [[ "$RUNNER_OS" == "macOS" ]]; then + artifact_name="codeql-bundle-osx64.tar.gz" + elif [[ "$RUNNER_OS" == "Windows" ]]; then + artifact_name="codeql-bundle-win64.tar.gz" + else + echo "::error::Unrecognized OS $RUNNER_OS" + exit 1 + fi + if [[ ${{ inputs.version }} == "nightly-latest" ]]; then - export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3` - echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT + tag=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3` + echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/$artifact_name" >> $GITHUB_OUTPUT elif [[ ${{ inputs.version }} == *"nightly"* ]]; then - export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'` - echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$VERSION-manual/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT + version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'` + echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version-manual/$artifact_name" >> $GITHUB_OUTPUT elif [[ ${{ inputs.version }} == *"stable"* ]]; then - export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'` - echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$VERSION/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT + version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'` + echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT elif [[ ${{ inputs.version }} == "latest" ]]; then echo "tools-url=latest" >> $GITHUB_OUTPUT elif [[ ${{ inputs.version }} == "cached" ]]; then diff --git a/.github/workflows/__test-local-codeql.yml b/.github/workflows/__test-local-codeql.yml index c0e7135ea9..710df8a81e 100644 --- a/.github/workflows/__test-local-codeql.yml +++ b/.github/workflows/__test-local-codeql.yml @@ -58,7 +58,7 @@ jobs: - id: init uses: ./../action/init with: - tools: ./codeql-bundle.tar.gz + tools: ./codeql-bundle-linux64.tar.gz - uses: ./../action/.github/actions/setup-swift with: codeql-path: ${{ steps.init.outputs.codeql-path }} diff --git a/pr-checks/checks/test-local-codeql.yml b/pr-checks/checks/test-local-codeql.yml index 79bf76199c..417c717dd2 100644 --- a/pr-checks/checks/test-local-codeql.yml +++ b/pr-checks/checks/test-local-codeql.yml @@ -12,7 +12,7 @@ steps: - id: init uses: ./../action/init with: - tools: ./codeql-bundle.tar.gz + tools: ./codeql-bundle-linux64.tar.gz - uses: ./../action/.github/actions/setup-swift with: codeql-path: ${{ steps.init.outputs.codeql-path }}