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

CI: only build without lockfile if dependencies changed #2643

Merged
merged 8 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build-without-lockfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
schedule:
- cron: "0 0 * * 1"
pull_request:
# Only run on PRs if dependencies were modified.
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"
workflow_dispatch:

concurrency:
Expand All @@ -33,3 +37,52 @@ jobs:
run: |
cargo generate-lockfile
cargo check --all-targets

- name: Comment on PR
uses: actions/github-script@v7
if: failure() && github.event_name == 'pull_request'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue_number = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const runUrl = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;

const commentTitle = "Unable to build without Cargo.lock file"
const commentBody = `${commentTitle}.

This means that after this change 3rd party projects may have
difficulties using crates in this repo as a dependency. If this
isn't easy to fix please open an issue so we can fix it later.

For the first failing build see: ${runUrl}

To reproduce locally run

\`\`\`
cargo generate-lockfile
cargo check --all-targets
\`\`\`

This PR can still be merged.`;

// Fetch existing comments
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number,
});

// Find existing comment
const existingComment = comments.find(c => c.body.startsWith(commentTitle));
if (!existingComment) {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body: commentBody
});
} else {
console.log("Already commented.")
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![Lint](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/lint.yml/badge.svg)](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/lint.yml)
[![Audit](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/audit.yml/badge.svg)](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/audit.yml)
[![Ubuntu](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/ubuntu-install-without-nix.yml/badge.svg)](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/ubuntu-install-without-nix.yml)
[![Build without lockfile](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/build-without-lockfile.yml/badge.svg)](https://github.com/EspressoSystems/espresso-sequencer/actions/workflows/build-without-lockfile.yml)
[![Coverage Status](https://coveralls.io/repos/github/EspressoSystems/espresso-sequencer/badge.svg?branch=main)](https://coveralls.io/github/EspressoSystems/espresso-sequencer?branch=main)

The Espresso Sequencer offers rollups credible neutrality and enhanced interoperability, without compromising on scale.
Expand Down
Loading