celo-org / celo-monorepo

Official repository for core projects comprising the Celo platform
https://celo.org
Apache License 2.0
697 stars 370 forks source link

Fix Foundry version across GitHub workflows #11032

Closed arthurgousset closed 3 months ago

arthurgousset commented 3 months ago

Discussed in https://github.com/celo-org/celo-monorepo/discussions/11027

Originally posted by **arthurgousset** June 7, 2024 Question re Github workflows and Foundry versions: I see that we're installing foundry in at least 3 different workflows: 1. [celo-org/celo-monorepo > workflows/`protocol-devchain-anvil.yml`](https://github.com/celo-org/celo-monorepo/blob/b10b77a5b3b1ac9e8750b246e786a649548a2556/.github/workflows/protocol-devchain-anvil.yml#L77-L80) 2. [celo-org/celo-monorepo > workflows/`protocol_tests.yml`](https://github.com/celo-org/celo-monorepo/blob/b10b77a5b3b1ac9e8750b246e786a649548a2556/.github/workflows/protocol_tests.yml#L51-L54) 3. [celo-org/developer-tooling > workflows/`ci.yml`](https://github.com/celo-org/developer-tooling/blob/ccc5cbb6c46a7f9f74c5b3fdfb1c3fd9fcee257d/.github/workflows/ci.yml#L221-L224) We're currently fixing foundry version at `nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9`. I expected the foundry version will change frequently, as we'll want to keep up with the latest Foundry releases. Unfortunately, we can't currently stay on the latest version, because it introduced a regression that breaks our workflows. Question: Does it make sense to set the Foundry version in one place so it can be fetched by all workflows? My thinking: 1. Con: I can see a downside where some versions work with some workflows and not with others. So it might be best to keep versions independent. 2. Pro: I can see a benefit where we want to upgrade in lock-steps and some workflows will fail because we forgot to upgrade the version.
arthurgousset commented 3 months ago

Starting work on this now. My estimates account for the fact that we're at a team offsite this week, and I won't have continuous undistracted time.

arthurgousset commented 3 months ago

Asked the DevOpsRE team for help to define the variable on Slack:

Hi devopsre :wave: Could someone with Github admin permissions for the celo-org (GitHub org) please help me out. I'd like to define a "variable" at the celo-org level that can be read across workflows in celo-org/celo-monorepo and celo-org/developer-tooling. More context in this issue: Fix Foundry version across GitHub workflows using an env variable#11032

Defining variables can be done in a few simple clicks (see screenshot): Creating configuration variables for an organization

  1. Variable name: SUPPORTED_FOUNDRY_VERSION
  2. Variable value: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9

I'm planning to read the variable in workflows like this:

env:
  # Foundry version set at celo-org (GitHub organisation) level, for consistency across workflows.
  FOUNDRY_VERSION: ${{ vars.SUPPORTED_FOUNDRY_VERSION }}

Let me know if you have any concerns, or there is a better way to do this. Thanks!

arthurgousset commented 3 months ago

Relevant PRs:

  1. https://github.com/celo-org/celo-monorepo/pull/11046
  2. https://github.com/celo-org/developer-tooling/pull/271