Skip to content

fix: specify correct path for pages artifact #10

fix: specify correct path for pages artifact

fix: specify correct path for pages artifact #10

Workflow file for this run

name: CI
on:
# Run daily at midnight.
schedule:
- cron: 0 0 * * *
# Run whenever this workflow is changed on the main branch.
push:
branches: [main]
# Run whenever a PR is opened or updated, but do not upload results.
pull_request:
# Allow running manually.
workflow_dispatch:
env:
# Force colorful output, even though we're running in Github Actions.
CARGO_TERM_COLOR: always
jobs:
bench:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Bencher
uses: bencherdev/bencher@main
- name: Install Linux dependencies
run: |
sudo apt-get update
# Installs Alsa and udev.
sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Cache build files
uses: Leafwing-Studios/cargo-cache@v1
# Run benchmarks, piping output to both `results.txt` and stdout.
- name: Run benchmarks
run: cargo bench -- 2>&1 | tee results.txt
- name: Find Bevy commit hash
id: bevy-hash
run: |
# Find the source property of Bevy, which returns something like:
# "git+https://github.com/bevyengine/bevy.git#d659a1f7d506c5c6eba9dfe2a6e878a8c72ecef6"
SOURCE=$(cargo metadata --format-version 1 | jq '.packages[] | select(.name == "bevy") | .source')
echo Bevy source is $SOURCE.
# Regex for a 40-character hexadecimal hash.
REGEX="[a-f0-9]{40}"
# Capture the hash from the source identifier.
HASH=$(echo $SOURCE | grep --extended-regexp --only-matching $REGEX)
echo Found hash is $HASH.
echo hash=$HASH >> $GITHUB_OUTPUT
- name: Upload results to Bencher
env:
BENCHER_PROJECT: bevy
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
BENCHER_TESTBED: github-actions
run: |
# Do not upload benchmarks for pull requests.
bencher run ${{ github.event_name == 'pull_request' && '--dry-run' || '' }} \
--adapter rust_criterion \
--hash ${{ steps.bevy-hash.outputs.hash }} \
--err \
--file results.txt
- name: Upload Criterion report
uses: actions/upload-artifact@v4
with:
name: criterion-report
path: target/criterion
if-no-files-found: error
file-size:
name: Track file size
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Bencher
uses: bencherdev/bencher@main
- name: Install Linux dependencies
run: |
sudo apt-get update
# Installs Alsa and udev.
sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Cache build files
uses: Leafwing-Studios/cargo-cache@v1
# Build all file-size binaries in release mode.
- name: Build binaries
run: cargo build --package file-size --profile file-size
- name: Find Bevy commit hash
id: bevy-hash
run: |
# Find the source property of Bevy, which returns something like:
# "git+https://github.com/bevyengine/bevy.git#d659a1f7d506c5c6eba9dfe2a6e878a8c72ecef6"
SOURCE=$(cargo metadata --format-version 1 | jq '.packages[] | select(.name == "bevy") | .source')
echo Bevy source is $SOURCE.
# Regex for a 40-character hexadecimal hash.
REGEX="[a-f0-9]{40}"
# Capture the hash from the source identifier.
HASH=$(echo $SOURCE | grep --extended-regexp --only-matching $REGEX)
echo Found hash is $HASH.
echo hash=$HASH >> $GITHUB_OUTPUT
- name: Upload benchmarks
env:
BENCHER_PROJECT: bevy
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
BENCHER_TESTBED: github-actions
run: |
# Do not upload benchmarks for pull requests.
bencher run ${{ github.event_name == 'pull_request' && '--dry-run' || '' }} \
--adapter json \
--hash ${{ steps.bevy-hash.outputs.hash }} \
--err \
--file-size target/file-size/default \
--file-size target/file-size/minimal \
--file-size target/file-size/empty
deploy-report:
name: Deploy report
runs-on: ubuntu-latest
needs: [bench]
if: ${{ github.event_name != 'pull_request' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download Crtierion report
uses: actions/download-artifact@v4
with:
name: criterion-report
path: ./
- name: Create redirect page
run: echo '<meta http-equiv=\"refresh\" content=\"0; url=report/index.html\">' > index.html
- name: Upload site artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./
- name: Deploy to Github Pages
id: deployment
uses: actions/deploy-pages@v4