diff --git a/.github/workflows/glibc_smoke_test.yml b/.github/workflows/glibc_smoke_test.yml deleted file mode 100644 index cd25bf5..0000000 --- a/.github/workflows/glibc_smoke_test.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: GLIBC Smoke Test -# Testing GLIBC compatibility - -on: - pull_request: - types: [ synchronize, opened, reopened, edited ] - paths: - - 'core/src/main/resources/io/questdb/bin/**' - - './core/src/main/bin/**' - workflow_dispatch: - -jobs: - amd64: - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} # Only run on non-forked PRs - runs-on: ubuntu-22.04 - container: - # Use Amazon Linux 2 image - uses GLIBC 2.26 - image: amazonlinux:2 - volumes: - - /node20217:/node20217 - - /node20217:/__e/node20 - steps: - - name: Install dependencies - run: yum install -y curl git tar gunzip xz wget - - name: Print GLIBC version - run: ldd --version - - name: Install Node.js 20 glibc2.17 - # A hack to override default nodejs 20 to a build compatible with older glibc. - # Inspired by https://github.com/pytorch/test-infra/pull/5959 If it's good for pytorch, it's good for us too! :) - # Q: Why do we need this hack at all? A: Because many github actions, include action/checkout@v4, depend on nodejs 20. - # GitHub Actions runner provides a build of nodejs 20 that requires a newer glibc than Amazon Linux 2 has. - # Thus we download a build of nodejs 20 that is compatible with Amazon Linux 2 and override the default one. - run: | - curl -LO https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz - tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217 - ldd /__e/node20/bin/node - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - - name: Install Apache Maven - # Amazon Linux 2 has too old version of Maven, so we need to install a newer one - run: | - wget https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.tar.gz - tar xf apache-maven-3.9.6-bin.tar.gz -C /opt - ln -sf /opt/apache-maven-3.9.6 /opt/maven - echo "MAVEN_HOME=/opt/maven" >> $GITHUB_ENV - echo "PATH=/opt/maven/bin:$PATH" >> $GITHUB_ENV - - name: Build distribution - run: /opt/maven/bin/mvn -B clean install -Dmaven.test.skip=true -Pbuild-binaries -pl 'core' - env: - MAVEN_OPTS: "-XX:+UseParallelGC" - - name: Unpack distribution - run: tar -xzf core/target/questdb-*-no-jre-bin.tar.gz - - name: Start QuestDB - run: ./questdb-*bin/questdb.sh start - - name: Query database with curl - run: | - curl -G --data-urlencode \ - "query=SELECT * FROM long_sequence(1)" \ - http://localhost:9000/exp - - name: Upload logs - if: failure() # Only upload logs if the job failed - uses: actions/upload-artifact@v4 - with: - path: ~/.questdb/log/* - name: logs - retention-days: 5 - aarch64: - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} # Only run on non-forked PRs - runs-on: ubuntu-22.04-arm - container: - # Use AlmaLinux 8 image - uses GLIBC 2.28 - image: almalinux:8 - steps: - - name: Install dependencies - run: dnf install -y curl zip unzip git bash wget - - name: Print GLIBC version - run: ldd --version - - name: Install Maven - the version in AlmaLinux 8 is too old - run: | - cd /opt - wget https://archive.apache.org/dist/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.zip - unzip apache-maven-3.9.9-bin.zip - ln -s /opt/apache-maven-3.9.9 /opt/maven - echo "MAVEN_HOME=/opt/maven" >> $GITHUB_ENV - echo "/opt/maven/bin" >> $GITHUB_PATH - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - - name: Build distribution - run: mvn -B clean install -Dmaven.test.skip=true -Pbuild-binaries -pl '!benchmarks' - env: - MAVEN_OPTS: "-XX:+UseParallelGC" - - name: Unpack distribution - run: tar -xzf core/target/questdb-*-no-jre-bin.tar.gz - - name: Start QuestDB - run: ./questdb-*bin/questdb.sh start - - name: Query database with curl - run: | - curl -G --data-urlencode \ - "query=SELECT * FROM long_sequence(1)" \ - http://localhost:9000/exp - - name: Upload logs - if: failure() # Only upload logs if the job failed - uses: actions/upload-artifact@v4 - with: - path: ~/.questdb/log/* - name: logs - retention-days: 5 - - - diff --git a/ci/run_oss_tests.yaml b/ci/run_oss_tests.yaml index 0b9ed28..91cde3a 100644 --- a/ci/run_oss_tests.yaml +++ b/ci/run_oss_tests.yaml @@ -6,6 +6,7 @@ steps: mavenPOMFile: "questdb/pom.xml" jdkVersionOption: "default" goals: "test" + mavenOptions: "-Xlog:gc -Dfile.encoding=UTF-8 -Xmx3072m -XX:+UseParallelGC" options: "--batch-mode --quiet -Dtest.include=**/cutlass/http/line/*,**/cutlass/line/**/* -DfailIfNoTests=false diff --git a/ci/validate-pr-title/dangerfile.js b/ci/validate-pr-title/dangerfile.js new file mode 100644 index 0000000..c60d626 --- /dev/null +++ b/ci/validate-pr-title/dangerfile.js @@ -0,0 +1,4 @@ +const { danger, fail } = require("danger"); +const { validate } = require("./validate"); + +validate({ title: danger.github.pr.title, onError: fail }); diff --git a/ci/validate-pr-title/readme.md b/ci/validate-pr-title/readme.md new file mode 100644 index 0000000..18a284d --- /dev/null +++ b/ci/validate-pr-title/readme.md @@ -0,0 +1,5 @@ +This folder contains configuration files which are used to run validation rules on Github pull requests titles. + +It is done by running [Danger JS](https://danger.systems/js/) tool in [github action](../../.github/workflows/danger.yml). + +In addition, the validation rules are tested. Tests can be executed with node, by running `node ./validate.test.js` diff --git a/ci/validate-pr-title/validate.js b/ci/validate-pr-title/validate.js new file mode 100644 index 0000000..3ca8c9c --- /dev/null +++ b/ci/validate-pr-title/validate.js @@ -0,0 +1,67 @@ +const allowedTypes = [ + "feat", + "fix", + "chore", + "docs", + "style", + "refactor", + "perf", + "test", + "ci", + "revert", +]; + +const allowedSubTypes = [ + "build", + "log", + "core", + "ilp", + "http", + "conf", + "utils", +]; + +const errorMessage = ` +Please update the PR title to match this format: +\`type(subType): description\` + +Where \`type\` is one of: +${allowedTypes.map((t) => `\`${t}\``).join(", ")} + +And: \`subType\` is one of: +${allowedSubTypes.map((t) => `\`${t}\``).join(", ")} + +For Example: + +\`\`\` +perf(sql): improve pattern matching performance for SELECT sub-queries +\`\`\` +`.trim(); + +/* The basic valid PR title formats are: + * 1. allowedType(allowedSubtype): optional description + * 2. allowedType: optional description + * + * consult ./validate.test.js for a full list + * */ +const prTitleRegex = new RegExp( + `^(((?:${allowedTypes.join("|")})\\((?:${allowedSubTypes.join( + "|", + )})\\))|build): .*`, +); + +function validate({ title, onError }) { + // Early return for title that matches predefined regex. + // No action required in such case. + if (title.match(prTitleRegex)) { + return; + } + + onError(errorMessage); +} + +module.exports = { + allowedTypes, + allowedSubTypes, + validate, +}; diff --git a/ci/validate-pr-title/validate.test.js b/ci/validate-pr-title/validate.test.js new file mode 100644 index 0000000..dc90e84 --- /dev/null +++ b/ci/validate-pr-title/validate.test.js @@ -0,0 +1,38 @@ +const assert = require("node:assert").strict; +const { validate, allowedTypes, allowedSubTypes } = require("./validate"); + +const testValid = (title) => + assert.doesNotThrow(() => + validate({ + title, + onError: () => { + throw `should accept "${title}"`; + }, + }) + ); + +const testInvalid = (title) => + assert.throws( + () => validate({ title, onError }), + `should NOT accept "${title}"` + ); + +allowedTypes.forEach((type) => { + allowedSubTypes.forEach((subType) => { + testValid( + `${type}(${subType}): foo`, + `should accept "${type}(${subType}): foo"` + ); + }); +}); + +testValid("build: 6.6"); +testValid("build: hello world"); +testInvalid("build"); + +testValid(`build: house`); +testInvalid(`build(house)`); + +testInvalid(`foo: bar`); +testInvalid(`update(bar): baz`); +testInvalid(`ui: updating stuff`);