Add global config, default workspace diagnostics to off #2019
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # The Linux binaries we ship are static musl builds (see | |
| # release.yml). CI builds, tests, and benchmarks the same target so | |
| # it exercises exactly what users run, including the mimalloc | |
| # allocator that is only compiled in for musl. | |
| CARGO_BUILD_TARGET: x86_64-unknown-linux-musl | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| targets: ${{ env.CARGO_BUILD_TARGET }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: build | |
| - name: Set up musl build | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools mold | |
| mkdir -p .cargo | |
| printf '[target.%s]\nrustflags = ["-C", "link-arg=-fuse-ld=mold"]\n' "$CARGO_BUILD_TARGET" >> .cargo/config.toml | |
| - run: cargo fmt --check | |
| - run: cargo clippy --all-targets -- -D warnings | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ env.CARGO_BUILD_TARGET }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: coverage | |
| - name: Set up musl build | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools mold | |
| mkdir -p .cargo | |
| printf '[target.%s]\nrustflags = ["-C", "link-arg=-fuse-ld=mold"]\n' "$CARGO_BUILD_TARGET" >> .cargo/config.toml | |
| - name: Install cargo-llvm-cov and cargo-nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-llvm-cov,cargo-nextest | |
| - name: Run tests with coverage | |
| run: cargo llvm-cov nextest --lcov --output-path lcov.info | |
| - name: Upload to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: lcov.info | |
| fail_ci_if_error: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| wasm: | |
| name: WebAssembly | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| targets: wasm32-wasip1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: wasm | |
| # `--target` on the command line overrides the musl CARGO_BUILD_TARGET | |
| # this workflow sets for every other job. | |
| - run: cargo clippy --lib --target wasm32-wasip1 -- -D warnings | |
| - name: Build the wasm reactor | |
| run: | | |
| cargo rustc --lib --crate-type cdylib \ | |
| --profile wasm-release --target wasm32-wasip1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Smoke-test the wasm reactor | |
| run: node scripts/wasm-smoke-test.mjs | |
| php-lint: | |
| name: PHP Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| ini-values: zend.assertions=1 | |
| - run: find examples/php -name '*.php' -print0 | xargs -0 -n1 php -l | |
| - run: php -d zend.assertions=1 examples/php/scaffolding/assertions.php | |
| - run: php -l examples/laravel/app/Demo.php | |
| benchmark: | |
| name: Benchmark | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ env.CARGO_BUILD_TARGET }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: build | |
| - name: Set up musl build | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools mold | |
| mkdir -p .cargo | |
| printf '[target.%s]\nrustflags = ["-C", "link-arg=-fuse-ld=mold"]\n' "$CARGO_BUILD_TARGET" >> .cargo/config.toml | |
| - name: Ensure gh-pages branch exists | |
| run: | | |
| if ! git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| empty_tree="$(git hash-object -t tree /dev/null)" | |
| commit="$(git commit-tree "$empty_tree" -m 'Initial gh-pages branch')" | |
| git push origin "$commit:refs/heads/gh-pages" | |
| fi | |
| - name: Run benchmarks | |
| run: cargo bench --bench completion -- --output-format bencher | tee raw_output.txt | |
| - name: Convert to milliseconds | |
| run: python3 benches/format_bench_output.py < raw_output.txt > output.json | |
| - name: Store benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: PHPantom Benchmarks | |
| tool: customSmallerIsBetter | |
| output-file-path: output.json | |
| gh-pages-branch: gh-pages | |
| benchmark-data-dir-path: dev/bench | |
| auto-push: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| benchmark-pr: | |
| name: Benchmark (PR comparison) | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ env.CARGO_BUILD_TARGET }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: build | |
| - name: Set up musl build | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools mold | |
| mkdir -p .cargo | |
| printf '[target.%s]\nrustflags = ["-C", "link-arg=-fuse-ld=mold"]\n' "$CARGO_BUILD_TARGET" >> .cargo/config.toml | |
| - name: Check gh-pages branch exists | |
| id: check-gh-pages | |
| run: | | |
| if git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| echo "⚠️ gh-pages branch does not exist yet — skipping PR benchmark comparison" | |
| fi | |
| - name: Run benchmarks | |
| if: steps.check-gh-pages.outputs.exists == 'true' | |
| run: cargo bench --bench completion -- --output-format bencher | tee raw_output.txt | |
| - name: Convert to milliseconds | |
| if: steps.check-gh-pages.outputs.exists == 'true' | |
| run: python3 benches/format_bench_output.py < raw_output.txt > output.json | |
| - name: Compare against baseline | |
| if: steps.check-gh-pages.outputs.exists == 'true' | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: PHPantom Benchmarks | |
| tool: customSmallerIsBetter | |
| output-file-path: output.json | |
| gh-pages-branch: gh-pages | |
| benchmark-data-dir-path: dev/bench | |
| auto-push: false | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| comment-on-alert: true | |
| alert-threshold: "130%" | |
| fail-on-alert: true | |
| alert-comment-cc-users: "@AJenbo" | |
| memory-benchmark: | |
| name: Memory Benchmark | |
| runs-on: ubuntu-latest | |
| needs: benchmark | |
| permissions: | |
| contents: write | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ env.CARGO_BUILD_TARGET }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: build | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| tools: composer | |
| - name: Set up musl build | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools mold | |
| mkdir -p .cargo | |
| printf '[target.%s]\nrustflags = ["-C", "link-arg=-fuse-ld=mold"]\n' "$CARGO_BUILD_TARGET" >> .cargo/config.toml | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Measure memory usage | |
| run: | | |
| # THP mode affects resident memory (2 MiB backing pages in | |
| # `always` mode); log it so the numbers are interpretable. | |
| cat /sys/kernel/mm/transparent_hugepage/enabled || true | |
| python3 benches/memory_usage.py --binary "target/$CARGO_BUILD_TARGET/release/phpantom_lsp" | tee memory_output.json | |
| - name: Store memory benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: PHPantom Memory Usage | |
| tool: customSmallerIsBetter | |
| output-file-path: memory_output.json | |
| gh-pages-branch: gh-pages | |
| benchmark-data-dir-path: dev/memory | |
| auto-push: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| memory-benchmark-pr: | |
| name: Memory Benchmark (PR comparison) | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ env.CARGO_BUILD_TARGET }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: build | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| tools: composer | |
| - name: Set up musl build | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools mold | |
| mkdir -p .cargo | |
| printf '[target.%s]\nrustflags = ["-C", "link-arg=-fuse-ld=mold"]\n' "$CARGO_BUILD_TARGET" >> .cargo/config.toml | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Check gh-pages branch exists | |
| id: check-gh-pages | |
| run: | | |
| if git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| echo "⚠️ gh-pages branch does not exist yet — skipping memory benchmark comparison" | |
| fi | |
| - name: Measure memory usage | |
| if: steps.check-gh-pages.outputs.exists == 'true' | |
| run: | | |
| cat /sys/kernel/mm/transparent_hugepage/enabled || true | |
| python3 benches/memory_usage.py --binary "target/$CARGO_BUILD_TARGET/release/phpantom_lsp" | tee memory_output.json | |
| - name: Compare against baseline | |
| if: steps.check-gh-pages.outputs.exists == 'true' | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: PHPantom Memory Usage | |
| tool: customSmallerIsBetter | |
| output-file-path: memory_output.json | |
| gh-pages-branch: gh-pages | |
| benchmark-data-dir-path: dev/memory | |
| auto-push: false | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| comment-on-alert: true | |
| alert-threshold: "130%" | |
| fail-on-alert: true | |
| alert-comment-cc-users: "@AJenbo" |