lzma: build the xz-core engine on wasm32 (#8664) #1
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
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [unlabeled, opened, synchronize, reopened] | |
| merge_group: | |
| # `workflow_dispatch` allows CodSpeed to trigger backtest | |
| # performance analysis in order to generate initial data. | |
| workflow_dispatch: | |
| name: CodSpeed | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| CI: true | |
| jobs: | |
| benchmarks: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} | |
| name: Run benchmarks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| permissions: | |
| contents: read | |
| id-token: write # for OpenID Connect authentication with CodSpeed | |
| env: | |
| CACHE_PATHS: | | |
| # https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci | |
| ~/.cargo/.crates2.json | |
| ~/.cargo/.crates.toml | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: dtolnay/rust-toolchain@stable | |
| # The benchmarks are linked against libpython through the pyo3 dev-dependency. | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| - name: Restore the machine main last measured on | |
| # A recording that cannot be fetched is read as "none yet", which the step | |
| # below treats as nothing to disagree with. Failing here instead would | |
| # turn a cache outage into a red benchmark job. | |
| continue-on-error: true | |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: build/codspeed-environment-reference.json | |
| key: codspeed-environment-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }} | |
| restore-keys: codspeed-environment-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Name the machine this run drew | |
| id: environment | |
| shell: bash | |
| run: | | |
| reference=build/codspeed-environment-reference.json | |
| if [ "$GITHUB_REF" = refs/heads/main ]; then | |
| args=(--record "$reference") | |
| else | |
| args=(--record build/codspeed-environment.json --reference "$reference") | |
| fi | |
| python3 scripts/codspeed-environment.py "${args[@]}" --github-output | |
| - name: Restore cache | |
| if: ${{ steps.environment.outputs.match != 'false' }} | |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ${{ env.CACHE_PATHS }} | |
| key: codspeed-v2-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: codspeed-v2- | |
| continue-on-error: true | |
| - name: Install cargo-codspeed | |
| if: ${{ steps.environment.outputs.match != 'false' }} | |
| run: cargo install cargo-codspeed --locked --version ^5 | |
| - name: Build the benchmark targets | |
| if: ${{ steps.environment.outputs.match != 'false' }} | |
| run: cargo codspeed build --locked --measurement-mode simulation -p rustpython -p rustpython-sre_engine | |
| - name: Save cache | |
| if: ${{ github.ref == 'refs/heads/main' }} # only save on main | |
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ${{ env.CACHE_PATHS }} | |
| key: codspeed-v2-${{ hashFiles('**/Cargo.lock') }} | |
| continue-on-error: true | |
| - name: Run the benchmarks | |
| if: ${{ steps.environment.outputs.match != 'false' }} | |
| uses: CodSpeedHQ/action@373d6868929f444bc08d901fd0eb0ad52a8875ea # v5.2.1 | |
| with: | |
| mode: simulation | |
| run: cargo codspeed run -p rustpython -p rustpython-sre_engine | |
| - name: Record the machine this baseline was measured on | |
| if: ${{ success() && github.ref == 'refs/heads/main' }} | |
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: build/codspeed-environment-reference.json | |
| key: codspeed-environment-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }} |