Skip to content

Nightly Tasks

Nightly Tasks #139

Workflow file for this run

name: Nightly Tasks
on:
schedule:
- cron: '0 7 * * *' # Nightly (ish) Pacific
workflow_dispatch:
inputs:
crate_count:
description: 'How many crates (sorted by downloads) to test'
default: 100
env:
RISC0_BUILD_LOCKED: 1
RISC0_RUST_TOOLCHAIN_VERSION: r0.1.79.0-2
RISC0_CPP_TOOLCHAIN_VERSION: 2024.01.05
jobs:
crates_validate:
runs-on: [self-hosted, prod, Linux, cpu]
env:
RUST_BACKTRACE: full
RUST_LOG: info
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rustup
- name: Set the variables
env:
DEFAULT_CRATE_COUNT: 1000
run: echo "TOP_N_CRATES=${{ github.event.inputs.crate_count || env.DEFAULT_CRATE_COUNT }}" >> $GITHUB_ENV
- run: cargo install --force --path risc0/cargo-risczero
- run: cargo run --bin rzup -- --verbose install rust $RISC0_RUST_TOOLCHAIN_VERSION
- run: cargo run --bin rzup -- --verbose install cpp $RISC0_CPP_TOOLCHAIN_VERSION
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: cargo build --release
working-directory: tools/crates-validator/
- name: Create working directory
run: mkdir -p ${{ runner.temp }}/crate-validation/
- name: Generate the profile
run: |
target/release/gen-profiles \
-P ${{ github.workspace }}/tools/crates-validator/profiles/config.yml \
-o ${{ runner.temp }}/crate-validation/profiles.yaml \
-c $TOP_N_CRATES
working-directory: tools/crates-validator/
- name: Validate profiles
run: |
target/release/main \
-p ${{ github.workspace }} \
-P ${{ runner.temp }}/crate-validation/profiles.yaml \
-o ${{ runner.temp }}/crate-validation/profile-results.json &> ${{ runner.temp }}/crate-validation/crate-results.log
shell: bash
working-directory: tools/crates-validator/
- name: Delete input profile
run: rm ${{ runner.temp }}/crate-validation/profiles.yaml
- run: tail -n 1 ${{ runner.temp }}/crate-validation/crate-results.log
if: always()
- name: Upload artifact results
uses: actions/upload-artifact@v4
if: always() # upload all artifacts even on failures
with:
name: crates-test-results
path: ${{ runner.temp }}/crate-validation/
retention-days: 2
- name: Clone ghpages repo
run: git clone "https://x-access-token:${{ secrets.BENCHMARK_TOKEN }}@github.com/risc0/ghpages.git" ${{ runner.temp }}/benchmarks/
- name: Export environment variable
run: |
echo "TEMP_DIR=${{ runner.temp }}" >> $GITHUB_ENV
echo "GITHUB_SHA=${{ github.sha }}" >> $GITHUB_ENV
- name: Commit results to risc0/ghpages
env:
GITHUB_SHA: ${{ github.sha }}
run: bash ./parse_profile_compilation_results.sh
working-directory: ./.github/scripts
alert_devops_if_failed:
runs-on: ubuntu-latest
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }}
needs: [crates_validate]
steps:
- name: DevOps Alert
env:
NEEDS: ${{ toJSON(needs) }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"Nightly Tasks Job Failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' ${{ secrets.DEVOPS_ALERT_WEBHOOK_URL }}