Skip to content

Commit

Permalink
bump rust-version to 1.81.0
Browse files Browse the repository at this point in the history
* ci: add rustfmt check to rust.yml
* ci: disable cronjob
  • Loading branch information
ValuedMammal committed Sep 16, 2024
1 parent a8f4ae9 commit 6d3b654
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 49 deletions.
80 changes: 40 additions & 40 deletions .github/workflows/cron-update-rust.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
name: Update stable rustc
on:
schedule:
- cron: "0 0 1,15 * *" # At 00:00 on day-of-month 1 and 15.
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update stable rustc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Update rust.yml to use latest stable
run: |
set -x
# Extract the date from whatever version of the compiler dtolnay/rust-toolchain gives us.
RUST_VERSION=$(rustc --verbose --version | sed -ne 's/^release: //p')
# Update the version in the reference file.
echo "${RUST_VERSION}" > rust-version
echo "rust_version=${RUST_VERSION}" >> $GITHUB_ENV
# In case of no new version don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated rustc. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update rustc but the latest stable date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.CREATE_PR_TOKEN }}
author: Update Rustc Bot <bot@example.com>
committer: Update Rustc Bot <bot@example.com>
title: Automated weekly update to rustc (to ${{ env.rust_version }})
body: |
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to rustc ${{ env.rust_version }}
branch: create-pull-request/weekly-stable-update
# name: Update rust version
# on:
# schedule:
# - cron: "0 0 15 * *" # At 00:00 on day-of-month 15.
# workflow_dispatch: # allows manual triggering
# jobs:
# format:
# name: Update stable rustc
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# - name: Update rust.yml to use latest stable
# run: |
# set -x
# # Extract the date from whatever version of the compiler dtolnay/rust-toolchain gives us.
# RUST_VERSION=$(rustc --verbose --version | sed -ne 's/^release: //p')
# # Update the version in the reference file.
# echo "${RUST_VERSION}" > rust-version
# echo "rust_version=${RUST_VERSION}" >> $GITHUB_ENV
# # In case of no new version don't make an empty PR.
# if ! git diff --exit-code > /dev/null; then
# echo "Updated rustc. Opening PR."
# echo "changes_made=true" >> $GITHUB_ENV
# else
# echo "Attempted to update rustc but the latest stable date did not change. Not opening any PR."
# echo "changes_made=false" >> $GITHUB_ENV
# fi
# - name: Create Pull Request
# if: env.changes_made == 'true'
# uses: peter-evans/create-pull-request@v6
# with:
# token: ${{ secrets.CREATE_PR_TOKEN }}
# author: Update Rustc Bot <bot@example.com>
# committer: Update Rustc Bot <bot@example.com>
# title: Automated weekly update to rustc (to ${{ env.rust_version }})
# body: |
# Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
# commit-message: Automated update to Github CI to rustc ${{ env.rust_version }}
# branch: create-pull-request/weekly-stable-update
17 changes: 9 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ on:
- main

jobs:
Prepare:
prepare:
runs-on: ubuntu-latest
outputs:
rust_version: ${{ steps.read_toolchain.outputs.rust_version }}
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Read rustc version"
- name: "Read rust version"
id: read_toolchain
run: echo "rust_version=$(cat rust-version)" >> $GITHUB_OUTPUT

Check:
check-stable:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
Expand All @@ -31,8 +31,8 @@ jobs:
- name: "Cargo check"
run: cargo check

Clippy:
needs: Prepare
format-and-lint:
needs: prepare
runs-on: ubuntu-latest
steps:
- name: "Checkout"
Expand All @@ -41,7 +41,8 @@ jobs:
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.rust_version }}
- name: "Install clippy"
run: rustup component add clippy
- name: "Lint"
components: rustfmt, clippy
- name: "rustfmt check"
run: cargo fmt --all -- --check
- name: "clippy"
run: cargo clippy -- -D warnings
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.80.1
1.81.0

0 comments on commit 6d3b654

Please sign in to comment.