|
| 1 | +# There was a bug, fixed in CLI v2.5.1, that didn't propagate environment |
| 2 | +# variables that the Java tracer needed. Here we test all languages |
| 3 | +# except Java for these CLI versions. In `unset-environment-new-cli.yml` |
| 4 | +# we test all languages for recent CLI versions. |
| 5 | +name: PR Check - Test unsetting environment variables for CLI version < 2.5.1 |
| 6 | +env: |
| 7 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 8 | + GO111MODULE: auto |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + - releases/v1 |
| 14 | + - releases/v2 |
| 15 | + pull_request: |
| 16 | + types: |
| 17 | + - opened |
| 18 | + - synchronize |
| 19 | + - reopened |
| 20 | + - ready_for_review |
| 21 | + workflow_dispatch: {} |
| 22 | +jobs: |
| 23 | + unset-environment: |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - os: ubuntu-latest |
| 28 | + version: stable-20210308 |
| 29 | + - os: ubuntu-latest |
| 30 | + version: stable-20210319 |
| 31 | + name: Test unsetting environment variables |
| 32 | + timeout-minutes: 45 |
| 33 | + runs-on: ${{ matrix.os }} |
| 34 | + steps: |
| 35 | + - name: Check out repository |
| 36 | + uses: actions/checkout@v3 |
| 37 | + - name: Prepare test |
| 38 | + id: prepare-test |
| 39 | + uses: ./.github/prepare-test |
| 40 | + with: |
| 41 | + version: ${{ matrix.version }} |
| 42 | + - uses: ./../action/init |
| 43 | + with: |
| 44 | + languages: csharp,cpp,go,javascript,python |
| 45 | + db-location: ${{ runner.temp }}/customDbLocation |
| 46 | + tools: ${{ steps.prepare-test.outputs.tools-url }} |
| 47 | + env: |
| 48 | + TEST_MODE: true |
| 49 | + - name: Build code |
| 50 | + shell: bash |
| 51 | + run: env -i PATH="$PATH" HOME="$HOME" ./build.sh |
| 52 | + - uses: ./../action/analyze |
| 53 | + id: analysis |
| 54 | + env: |
| 55 | + TEST_MODE: true |
| 56 | + - shell: bash |
| 57 | + run: | |
| 58 | + CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" |
| 59 | + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then |
| 60 | + echo "::error::Did not create a database for CPP, or created it in the wrong location." \ |
| 61 | + "Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'" |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | + CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" |
| 65 | + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then |
| 66 | + echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \ |
| 67 | + "Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'" |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | + GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" |
| 71 | + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then |
| 72 | + echo "::error::Did not create a database for Go, or created it in the wrong location." \ |
| 73 | + "Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'" |
| 74 | + exit 1 |
| 75 | + fi |
| 76 | + JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" |
| 77 | + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then |
| 78 | + echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ |
| 79 | + "Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'" |
| 80 | + exit 1 |
| 81 | + fi |
| 82 | + PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" |
| 83 | + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then |
| 84 | + echo "::error::Did not create a database for Python, or created it in the wrong location." \ |
| 85 | + "Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'" |
| 86 | + exit 1 |
| 87 | + fi |
| 88 | + env: |
| 89 | + INTERNAL_CODEQL_ACTION_DEBUG_LOC: true |
0 commit comments