diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 00000000000000..baa5dd85583110 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,33 @@ +name: codspeed-benchmarks + +on: + # Run on pushes to the master branch + push: + branches: + - "master" + # Run on pull requests + pull_request: + # `workflow_dispatch` allows CodSpeed to trigger backtest + # performance analysis in order to generate initial data. + workflow_dispatch: + +jobs: + benchmarks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup rust toolchain, cache and cargo-codspeed binary + uses: moonrepo/setup-rust@v1 + with: + cache-target: release + bins: cargo-codspeed + + - name: Build the benchmark target(s) + working-directory: v3 + run: cargo codspeed build -p engine -p lang-graphql + + - name: Run the benchmarks + uses: CodSpeedHQ/action@v2 + with: + working-directory: v3 + run: cargo codspeed run -p engine -p lang-graphql diff --git a/.github/workflows/hlint.yml b/.github/workflows/hlint.yml deleted file mode 100644 index 066048b806bbd3..00000000000000 --- a/.github/workflows/hlint.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: server lint -on: - label: - pull_request: - paths: - - "server/**" - -jobs: - hlint: - runs-on: ubuntu-20.04 - if: "!contains(github.event.pull_request.labels.*.name, 'ignore-server-hlint-checks') && github.event.label.name != 'ignore-server-hlint-checks'" - env: - working-directory: . - HLINT_BASE_URL: https://github.com/ndmitchell/hlint/releases/download - HLINT_ARCH: x86_64 - HLINT_OS: linux - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download hlint - run: | - HLINT_VERSION="$(jq -r '.hlint' ./server/VERSIONS.json)" - HLINT_URL="${{env.HLINT_BASE_URL}}/v${HLINT_VERSION}/hlint-${HLINT_VERSION}-${{env.HLINT_ARCH}}-${{env.HLINT_OS}}.tar.gz" - echo "Downloading from ${HLINT_URL}" - curl --fail --location --output "./hlint.tar.gz" "${HLINT_URL}" - tar xvf \ - hlint.tar.gz \ - --directory='.' \ - --strip-components=1 \ - "hlint-${HLINT_VERSION}/hlint" - - - name: Run hlint - shell: bash - run: | - CHANGED_HS_FILES=$(git diff --name-only origin/${{github.base_ref}}...${{github.sha}} -- "./*.hs" | xargs -i -d '\n' sh -c 'ls -d {} 2>/dev/null || true') - echo "$CHANGED_HS_FILES" - JQ_SCRIPT='.[] | "::" + (if (.severity=="Warning" or .severity=="Error") then "error" else "warning" end) + " file=\(.file),line=\(.startLine),col=\(.startColumn)::\(.severity):" + " \(.hint)%0AFound:%0A \(.from | gsub("\n";"%0A "))%0A" + try ("Perhaps:%0A " + (.to | gsub("\n";"%0A ")) + "%0A") catch "" + try (if .note | length > 0 then "Note:%0A " + (.note | join("\n") | gsub("\n";"%0A ")) else "" end) catch ""' - if [[ "$CHANGED_HS_FILES" ]] - then - OUT=$(mktemp) - echo "$CHANGED_HS_FILES" | xargs ${{env.working-directory}}/hlint --no-exit-code --json --hint=./.hlint.yaml | jq -r "$JQ_SCRIPT" | tee $OUT - test -z "$(grep -E '^::error' $OUT)" - fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 384deb8d429d79..00000000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: console lint -on: - pull_request: - paths: - - 'console/**' - -jobs: - lint: - runs-on: ubuntu-latest - env: - working-directory: ./console - - steps: - - uses: actions/checkout@v2 - - - name: Use Node.js 12 - uses: actions/setup-node@v1 - with: - node-version: 12.x - - - name: Install - working-directory: ${{env.working-directory}} - run: npm ci - - - name: Lint - working-directory: ${{env.working-directory}} - run: npm run lint:quiet - - - name: Format - working-directory: ${{env.working-directory}} - run: npm run format:check diff --git a/v3/Cargo.lock b/v3/Cargo.lock index e978103ec93da9..b0cf05bbcc5e2d 100644 --- a/v3/Cargo.lock +++ b/v3/Cargo.lock @@ -516,12 +516,46 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +[[package]] +name = "codspeed" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a104ac948e0188b921eb3fcbdd55dcf62e542df4c7ab7e660623f6288302089" +dependencies = [ + "colored", + "libc", + "serde_json", +] + +[[package]] +name = "codspeed-criterion-compat" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "722c36bdc62d9436d027256ce2627af81ac7a596dfc7d13d849d0d212448d7fe" +dependencies = [ + "codspeed", + "colored", + "criterion", + "futures", + "tokio", +] + [[package]] name = "colorchoice" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "combine" version = "3.8.1" @@ -912,7 +946,7 @@ dependencies = [ "build-data", "bytes", "clap", - "criterion", + "codspeed-criterion-compat", "derive_more", "futures-util", "goldenfile", @@ -1616,7 +1650,7 @@ dependencies = [ "axum", "bincode", "bson", - "criterion", + "codspeed-criterion-compat", "diffy", "expect-test", "graphql-parser", diff --git a/v3/crates/engine/Cargo.toml b/v3/crates/engine/Cargo.toml index 8c77346c4f1260..e270eb7b1cf2d6 100644 --- a/v3/crates/engine/Cargo.toml +++ b/v3/crates/engine/Cargo.toml @@ -70,7 +70,7 @@ url = "2.4.1" build-data = "0.1.5" # To set short commit-sha at build time [dev-dependencies] -criterion = { version = "0.5", features = ["html_reports", "async_tokio"] } +criterion = { package="codspeed-criterion-compat", version = "2.6.0", features = ["html_reports", "async_tokio"] } goldenfile = "1.7.1" mockito = { version = "1.1.0", default-features = false, features = [] } pretty_assertions = "1.3.0" diff --git a/v3/crates/lang-graphql/Cargo.toml b/v3/crates/lang-graphql/Cargo.toml index 56d32a74442d81..c676aea54e24c1 100644 --- a/v3/crates/lang-graphql/Cargo.toml +++ b/v3/crates/lang-graphql/Cargo.toml @@ -43,7 +43,7 @@ apollo-parser = "0.7" async-graphql-parser = "7.0" bincode = "1.3.3" bson = "2.10.0" -criterion = { version = "0.5", features = ["html_reports"] } +criterion = { package="codspeed-criterion-compat", version = "2.6.0", features = ["html_reports"] } diffy = "0.3.0" expect-test = "1.5" graphql-parser = "0.4"