Update dependencies #74
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
name: Update dependencies | |
on: | |
workflow_dispatch: | |
schedule: | |
# At 07:00 UTC on day-of-month 1 and 15. Use https://crontab.guru/ to edit this. | |
- cron: '0 7 1,15 * *' | |
jobs: | |
# Update the version of rustc, open a PR and assign a developer. | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Cache cargo | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "shared" | |
- name: Install cargo-outdated | |
run: cargo install --locked cargo-outdated | |
- name: Update dependencies | |
run: | | |
VIPER_VERSION="$( | |
curl https://api.github.com/repos/viperproject/viper-ide/releases | jq -r 'first | .tag_name' | |
)" | |
echo "The latest Viper version is $VIPER_VERSION" | |
echo "$VIPER_VERSION" > viper-toolchain | |
NIGHTLY_VERSION="nightly-$( | |
curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/rustc-dev | |
)" | |
echo "The latest usable version of rustc is $NIGHTLY_VERSION" | |
sed -i 's/^channel\s*=.*$/channel = "'"$NIGHTLY_VERSION"'"/' rust-toolchain | |
declare -a DEVELOPERS=(Aurel300 fpoli JonasAlaif vakaras) | |
UPDATE_NUMBER=$(( 10#$(date +%m) * 2 + (10#$(date +%d) / 15) - 0 )) | |
DEVELOPER="${DEVELOPERS[ $UPDATE_NUMBER % ${#DEVELOPERS[@]} ]}" | |
echo "The assigned developer is $DEVELOPER" | |
mv prusti-contracts/Cargo.toml prusti-contracts/Cargo_disabled.toml | |
OUTDATED_DEPENDENCIES="$(cargo outdated --root-deps-only --workspace 2>&1 || echo "cargo outdated failed to execute")" | |
mv prusti-contracts/Cargo_disabled.toml prusti-contracts/Cargo.toml | |
echo "VIPER_VERSION=$VIPER_VERSION" >> $GITHUB_ENV | |
echo "NIGHTLY_VERSION=$NIGHTLY_VERSION" >> $GITHUB_ENV | |
echo "DEVELOPER=$DEVELOPER" >> $GITHUB_ENV | |
echo "OUTDATED_DEPENDENCIES<<EOF" >> $GITHUB_ENV | |
echo "$OUTDATED_DEPENDENCIES" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Open a pull request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
# Use viper-admin's token to workaround a restriction of GitHub. | |
# See: https://github.com/peter-evans/create-pull-request/issues/48 | |
token: ${{ secrets.VIPER_ADMIN_TOKEN }} | |
commit-message: Update dependencies (rustc ${{ env.NIGHTLY_VERSION }}, viper ${{ env.VIPER_VERSION }}) | |
title: Update dependencies (rustc ${{ env.NIGHTLY_VERSION }}, viper ${{ env.VIPER_VERSION }}) | |
branch: auto-update-${{ env.NIGHTLY_VERSION }} | |
delete-branch: true | |
assignees: ${{ env.DEVELOPER }} | |
body: | | |
* [x] Update Viper version to `${{ env.VIPER_VERSION }}`. | |
* [x] Update rustc version to `${{ env.NIGHTLY_VERSION }}`. | |
* [ ] Run `cargo audit` and fix the issues. | |
* [ ] Manualy update outdated dependencies (see the list below). | |
* [ ] Manualy run `cargo update`. | |
<details><summary>List of direct outdated dependencies:</summary> | |
``` | |
$ mv prusti-contracts/Cargo.toml prusti-contracts/Cargo_disabled.toml | |
$ cargo outdated --root-deps-only --workspace | |
${{ env.OUTDATED_DEPENDENCIES }} | |
$ mv prusti-contracts/Cargo_disabled.toml prusti-contracts/Cargo.toml | |
``` | |
</details> | |
@${{ env.DEVELOPER }} could you take care of this? |