Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Address semgrep findings #3394

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/build-node-wrapper/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ runs:
- name: Build
shell: bash
working-directory: ./node
env:
TARGET: ${{ inputs.target }}
PUBLISH: ${{ inputs.publish }}
run: |
source "$HOME/.cargo/env"
TARGET_FLAG=`if [ "${{ inputs.target }}" != '' ]; then echo "--target ${{ inputs.target }}"; fi`
BUILD_FLAG=`if [ "${{ inputs.publish }}" == 'true' ]; then echo "build:release"; else echo "build"; fi`
TARGET_FLAG=`if [ "$TARGET" != '' ]; then echo "--target $TARGET"; fi`
BUILD_FLAG=`if [ "$PUBLISH" == 'true' ]; then echo "build:release"; else echo "build"; fi`
npm run $BUILD_FLAG --build-flags="$TARGET_FLAG"
4 changes: 3 additions & 1 deletion .github/workflows/build-python-wrapper/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ runs:

- name: Install Python software dependencies
shell: bash
env:
OS: ${{ inputs.os }}
run: |
# Disregarding PEP 668 as it addresses package managers conflicts, which is not applicable in the CI scope.
INSTALL_FLAGS=`if [[ "${{ inputs.os }}" =~ .*"macos".* ]]; then echo "--break-system-packages"; else echo ""; fi`
INSTALL_FLAGS=`if [[ "$OS" =~ .*"macos".* ]]; then echo "--break-system-packages"; else echo ""; fi`
python3 -m ensurepip --upgrade || true
python3 -m pip install --upgrade pip $INSTALL_FLAGS
python3 -m pip install virtualenv mypy-protobuf $INSTALL_FLAGS
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/create-test-matrices/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,26 @@ outputs:
runs:
using: "composite"
steps:
- name: "Setup Environment Variables"
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
RUN_FULL_MATRIX: ${{ inputs.run-full-matrix }}
CONTAINERS: ${{ inputs.containers }}
LANGUAGE_NAME: ${{ inputs.language-name }}
run: |
echo "EVENT_NAME=$EVENT_NAME" >> $GITHUB_ENV
echo "RUN_FULL_MATRIX=$RUN_FULL_MATRIX" >> $GITHUB_ENV
echo "CONTAINERS=$CONTAINERS" >> $GITHUB_ENV
echo "LANGUAGE_NAME=$LANGUAGE_NAME" >> $GITHUB_ENV

- name: Load engine matrix
id: load-engine-matrix
shell: bash
run: |
set -o pipefail
echo 'Select server engines to run tests against'
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "push" || "${{ inputs.run-full-matrix }}" == "false" ]]; then
if [[ "$EVENT_NAME" == "pull_request" || "$EVENT_NAME" == "push" || "$RUN_FULL_MATRIX" == "false" ]]; then
echo 'Pick engines marked as `"run": "always"` only - on PR, push or manually triggered job which does not require full matrix'
jq -c '[.[] | select(.run == "always")]' < .github/json_matrices/engine-matrix.json | awk '{ printf "engine-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
else
Expand All @@ -52,14 +65,14 @@ runs:
shell: bash
run: |
set -o pipefail
[[ "${{ inputs.containers }}" == "true" ]] && CONDITION=".IMAGE?" || CONDITION=".IMAGE == null"
[[ "$CONTAINERS" == "true" ]] && CONDITION=".IMAGE?" || CONDITION=".IMAGE == null"
echo 'Select runners (VMs) to run tests on'
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "push" || "${{ inputs.run-full-matrix }}" == "false" ]]; then
if [[ "$EVENT_NAME" == "pull_request" || "$EVENT_NAME" == "push" || "$RUN_FULL_MATRIX" == "false" ]]; then
echo 'Pick runners marked as '"run": "always"' only - on PR, push or manually triggered job which does not require full matrix'
jq -c '[.[] | select(.run == "always")]' < .github/json_matrices/build-matrix.json | awk '{ printf "host-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
else
echo 'Pick all runners assigned for the chosen client (language) - on cron (schedule) or if manually triggered job requires a full matrix'
jq -c "[.[] | select(.languages? and any(.languages[] == \"${{ inputs.language-name }}\"; .) and $CONDITION)]" < .github/json_matrices/build-matrix.json | awk '{ printf "host-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
jq -c "[.[] | select(.languages? and any(.languages[] == \"$LANGUAGE_NAME\"; .) and $CONDITION)]" < .github/json_matrices/build-matrix.json | awk '{ printf "host-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
fi

- name: Create language version matrix
Expand All @@ -68,10 +81,10 @@ runs:
run: |
set -o pipefail
echo 'Select language (framework/SDK) versions to run tests on'
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "push" || "${{ inputs.run-full-matrix }}" == "false" ]]; then
if [[ "$EVENT_NAME" == "pull_request" || "$EVENT_NAME" == "push" || "$RUN_FULL_MATRIX" == "false" ]]; then
echo 'Pick language versions listed in 'always-run-versions' only - on PR, push or manually triggered job which does not require full matrix'
jq -c '[.[] | select(.language == "${{ inputs.language-name }}") | .["always-run-versions"]][0] // []' < .github/json_matrices/supported-languages-versions.json | awk '{ printf "version-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
jq -c '[.[] | select(.language == "$LANGUAGE_NAME") | .["always-run-versions"]][0] // []' < .github/json_matrices/supported-languages-versions.json | awk '{ printf "version-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
else
echo 'Pick language versions listed in 'versions' - on cron (schedule) or if manually triggered job requires a full matrix'
jq -c '[.[] | select(.language == "${{ inputs.language-name }}") | .versions][0]' < .github/json_matrices/supported-languages-versions.json | awk '{ printf "version-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
jq -c '[.[] | select(.language == "$LANGUAGE_NAME") | .versions][0]' < .github/json_matrices/supported-languages-versions.json | awk '{ printf "version-matrix=%s\n", $0 }' | tee -a $GITHUB_OUTPUT
fi
Loading