Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate CBMC update #2895

Merged
merged 9 commits into from
Nov 29, 2023
Merged
47 changes: 47 additions & 0 deletions .github/workflows/cargo-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT

name: Attempt cargo update

on:
schedule:
- cron: "30 3 * * Mon" # Run this every Monday at 03:30 UTC
workflow_dispatch: # Allow manual dispatching for a custom branch / tag.

permissions:
checks: write
contents: write
pull-requests: write

jobs:
create-cargo-update-pr:
runs-on: ubuntu-22.04
steps:
- name: Checkout Kani
uses: actions/checkout@v3

- name: Setup Kani Dependencies
uses: ./.github/actions/setup
with:
os: ubuntu-22.04

- name: Run cargo update
env:
GH_TOKEN: ${{ github.token }}
run: |
today=$(date +%Y-%m-%d)
echo "today=$today" >> $GITHUB_ENV
if ! git ls-remote --exit-code origin cargo-update-$today ; then
cargo update
cargo build-dev
git diff
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: Upgrade cargo dependencies to ${{ env.today }}
branch: cargo-update-${{ env.today }}
tautschnig marked this conversation as resolved.
Show resolved Hide resolved
delete-branch: true
title: 'Automatic cargo update to ${{ env.today }}'
body: >
Dependency upgrade resulting from `cargo update`.
48 changes: 48 additions & 0 deletions .github/workflows/cbmc-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT

name: Attempt CBMC update

on:
schedule:
- cron: "30 4 * * Mon" # Run this every Monday at 04:30 UTC
tautschnig marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch: # Allow manual dispatching for a custom branch / tag.

permissions:
checks: write
contents: write
pull-requests: write

jobs:
create-cargo-update-pr:
runs-on: ubuntu-22.04
steps:
- name: Checkout Kani
uses: actions/checkout@v3

- name: Compare CBMC versions
env:
GH_TOKEN: ${{ github.token }}
run: |
tautschnig marked this conversation as resolved.
Show resolved Hide resolved
grep ^CBMC_VERSION kani-dependencies >> $GITHUB_ENV
CBMC_LATEST=$(gh -R diffblue/cbmc release list | grep Latest | awk '{print $1}' | cut -f2 -d-)
echo "CBMC_LATEST=$CBMC_LATEST" >> $GITHUB_ENV
if [ x$CBMC_LATEST != x$CBMC_VERSION ] ; then
tautschnig marked this conversation as resolved.
Show resolved Hide resolved
if ! git ls-remote --exit-code origin cbmc-$CBMC_LATEST ; then
CBMC_LATEST_MAJOR=$(echo $CBMC_LATEST | cut -f1 -d.)
CBMC_LATEST_MINOR=$(echo $CBMC_LATEST | cut -f2 -d.)
sed -i "s/^CBMC_MAJOR=.*/CBMC_MAJOR=\"$CBMC_MAJOR\"/" kani-dependencies
sed -i "s/^CBMC_MINOR=.*/CBMC_MINOR=\"$CBMC_MINOR\"/" kani-dependencies
sed -i "s/^CBMC_VERSION=.*/CBMC_VERSION=\"$CBMC_LATEST\"/" kani-dependencies
git diff
fi
fi
- name: Create Pull Request
tautschnig marked this conversation as resolved.
Show resolved Hide resolved
uses: peter-evans/create-pull-request@v5
tautschnig marked this conversation as resolved.
Show resolved Hide resolved
with:
commit-message: Upgrade CBMC from ${{ env.CBMC_VERSION }} to ${{ env.CBMC_LATEST }}
branch: cbmc-${{ env.CBMC_LATEST }}
delete-branch: true
title: 'Automatic upgrade of CBMC from ${{ env.CBMC_VERSION }} to ${{ env.CBMC_LATEST }}'
body: >
Upgrade CBMC to its latest release.