fix: resolve potential buffer re-use in getSystemVar (#15) #93
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: Test | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_call: | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'PR number to test' | |
| required: true | |
| type: number | |
| env: | |
| S2_TEST_USER: root | |
| S2_TEST_PORT: 5506 | |
| S2_TEST_ADDR: 127.0.0.1:5506 | |
| S2_TEST_DB_NAME: gotest | |
| S2_TEST_CONCURRENT: 0 | |
| jobs: | |
| fetch-s2-versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| versions: ${{ steps.get_versions.outputs.versions }} | |
| steps: | |
| - name: Get supported versions of SingleStore | |
| id: get_versions | |
| uses: singlestore-labs/singlestore-supported-versions@main | |
| with: | |
| include_rc: true | |
| generate-matrix: | |
| runs-on: ubuntu-latest | |
| needs: fetch-s2-versions | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Build pairs of Go and SingleStore versions | |
| id: set-matrix | |
| env: | |
| S2_VERSIONS: ${{ needs.fetch-s2-versions.outputs.versions }} | |
| run: | | |
| import itertools, json, os | |
| go_versions = ["1.21", "1.22", "1.23", "1.24"] | |
| s2_versions = json.loads(os.environ['S2_VERSIONS']) | |
| if len(go_versions) <= len(s2_versions): | |
| pairs = list(zip(itertools.cycle(go_versions), s2_versions)) | |
| else: | |
| pairs = list(zip(go_versions, itertools.cycle(s2_versions))) | |
| matrix = json.dumps({"include":[{"go":g,"singlestore_version":s} for g,s in pairs]}) | |
| with open(os.environ["GITHUB_OUTPUT"], "a") as f: | |
| f.write(f"matrix={matrix}\n") | |
| shell: python | |
| test: | |
| needs: generate-matrix | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/merge', github.event.inputs.pr_number) || github.ref }} | |
| - name: Clean disk on GitHub Runner | |
| run: ./.github/scripts/clean_disk_github_runner.sh | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.8.0 | |
| - name: Install MySQL client | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y mysql-client | |
| - name: Save password to output | |
| id: s2_pw | |
| run: echo "singlestore_password=$(openssl rand -base64 16)" >> $GITHUB_OUTPUT | |
| - name: Setup test cluster | |
| run: ./.github/scripts/setup-singlestore-dev.sh | |
| env: | |
| S2_TEST_PASS: ${{ steps.s2_pw.outputs.singlestore_password }} | |
| SINGLESTORE_VERSION: ${{ matrix.singlestore_version }} | |
| - name: Run tests | |
| env: | |
| S2_TEST_PASS: ${{ steps.s2_pw.outputs.singlestore_password }} | |
| run: | | |
| go test -v -race |