name: "Prepare test" description: Performs some preparation to run tests inputs: version: description: "The version of the CodeQL CLI to use. Can be 'linked', 'default', 'nightly-latest', 'nightly-YYYYMMDD', or 'stable-vX.Y.Z" required: true use-all-platform-bundle: description: "If true, we output a tools URL with codeql-bundle.tar.gz file rather than platform-specific URL" default: 'false' required: false setup-kotlin: description: "If true, we setup kotlin" default: 'true' required: true outputs: tools-url: description: "The value that should be passed as the 'tools' input of the 'init' step." value: ${{ steps.get-url.outputs.tools-url }} runs: using: composite steps: - name: Move codeql-action shell: bash run: | mkdir ../action mv * .github ../action/ mv ../action/tests/multi-language-repo/{*,.github} . mv ../action/.github/workflows .github - id: get-url name: Determine URL shell: bash run: | set -e # Fail this Action if `gh release list` fails. if [[ ${{ inputs.version }} == "linked" ]]; then echo "tools-url=linked" >> "$GITHUB_OUTPUT" exit 0 elif [[ ${{ inputs.version }} == "default" ]]; then echo "tools-url=" >> "$GITHUB_OUTPUT" exit 0 fi if [[ ${{ inputs.version }} == "nightly-latest" && "$RUNNER_OS" != "Windows" ]]; then extension="tar.zst" else extension="tar.gz" fi if [[ ${{ inputs.use-all-platform-bundle }} == "true" ]]; then artifact_name="codeql-bundle.$extension" elif [[ "$RUNNER_OS" == "Linux" ]]; then artifact_name="codeql-bundle-linux64.$extension" elif [[ "$RUNNER_OS" == "macOS" ]]; then artifact_name="codeql-bundle-osx64.$extension" elif [[ "$RUNNER_OS" == "Windows" ]]; then artifact_name="codeql-bundle-win64.$extension" else echo "::error::Unrecognized OS $RUNNER_OS" exit 1 fi if [[ ${{ inputs.version }} == "nightly-latest" ]]; then 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 version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'` echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT elif [[ ${{ inputs.version }} == *"stable"* ]]; then 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 else echo "::error::Unrecognized version specified!" exit 1 fi - uses: fwilhe2/setup-kotlin@9c245a6425255f5e98ba1ce6c15d31fce7eca9da if: ${{ inputs.setup-kotlin == 'true' }} with: version: 1.8.21