update CI #61
This file contains 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
# Simple workflow for deploying static content to GitHub Pages | |
name: pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["master"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: read | |
actions: write # require to delete cache | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_VERSION: "1.82.0" | |
CACHE_KEY_BENCH: bench-report | |
jobs: | |
regression: | |
strategy: | |
max-parallel: 4 | |
matrix: | |
build: [liberty-io, libertyparse, liberty2json, liberty-db-latest, liberty-db-nightly, liberty-db-0p6p3, liberty-db-0p5p9, liberty-db-0p4p13, liberty-db-0p3p1] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to ${{ matrix.build }} | |
run: echo "Deploying to ${{ matrix.build }}" | |
bench: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- name: Obtain baseline data (result of last time) | |
uses: actions/cache/restore@v4 | |
with: | |
path: target/criterion | |
key: ${{ env.CACHE_KEY_BENCH }} | |
- run: cargo bench --package dev | |
- name: Clear last bench results | |
continue-on-error: true # Don't fail if the cache doesn't exist | |
env: | |
GH_TOKEN: ${{ github.token }} # required by gh | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete ${{ env.CACHE_KEY_BENCH }} --confirm -R ${{ github.repository }} | |
- name: Archive bench results | |
uses: actions/cache/save@v4 | |
with: | |
key: ${{ env.CACHE_KEY_BENCH }} | |
path: target/criterion | |
deploy: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: bench | |
steps: | |
- uses: actions/checkout@v4 | |
# https://github.com/actions/cache/issues/1444 | |
# If the target path doesn't match the source path, | |
# restore reports "Cache not found for input keys" | |
- name: Load bench results | |
uses: actions/cache/restore@v4 | |
with: | |
path: target/criterion | |
key: ${{ env.CACHE_KEY_BENCH }} | |
- run: mv target/criterion docs/static/bench | |
- name: Upload Static Files as Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/static | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |