Skip to content
elanthia-onlinePublic

About

Shared CI and repository standards for Elanthia Online projects

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elanthia-online/.github

Shared CI and repository standards for Elanthia Online projects.

Path What it is
.github/workflows/ruby-ci.yml Shared lint, test and lockfile workflow. Repos call it from their own ci.yml, pinned to a release (see Versions and releases).
rubocop/ Master copy of the shared RuboCop rules (base.yml) and the custom ASCII cop. Each repo keeps a byte-identical copy under .rubocop/, and the shared workflow fails if a copy differs.
rulesets/ Branch and tag protection definitions.
bin/apply-rulesets Applies the rulesets and shared repository settings. Run by an admin after a change to rulesets/ merges; see the comment at the top of the script.
bin/sync-lockfile Aligns a repo's Gemfile.lock and .ruby-version with lich-5's, or checks that they are aligned (--check). See the comment at the top of the script.
bin/lockfile-check Runs bin/sync-lockfile --check the way CI needs it (base-branch baseline on pull requests, job summary). Used by the three workflows below.
.github/workflows/lockfile-sync.yml The lockfile check on its own, for a Ruby repo that doesn't call ruby-ci.yml (which already runs it). Such a repo calls it from its own ci.yml, pinned to a release, and lists it in ci-gate.
.github/workflows/lockfile-drift.yml Daily run of the lockfile check over every repo that calls ruby-ci.yml.

Changing the shared RuboCop rules means updating rubocop/ and the two hashes in ruby-ci.yml together (self-check.yml enforces this). Each repo then copies the new files in the PR that moves its pin to the release with the change (see below).

Versions and releases

Repos pin a release, never a branch: the full commit SHA of a release tag, with the version as a comment on the same line.

uses: elanthia-online/.github/.github/workflows/ruby-ci.yml@<sha> # v1.0.0

Each repo's Dependabot (github-actions at /) sees newer release tags and opens a PR that changes the SHA and the comment together. A change merged to main reaches the repos only when it ships in a release.

  • Versions follow semver. A minor or patch release is compatible: a bumped action, a fix, a new optional input. A major release changes the interface: a renamed or removed input, or behaviour a repo has to react to. Its release notes say what each repo must change.

  • Tags never move. The release tags ruleset blocks updating or deleting v* tags, so every release is a new tag (v1.1.0). There is no floating v1.

  • To release, merge to main, then tag the merge commit and publish a release on that tag, with notes on what the repos pick up:

    git push origin <sha>:refs/tags/vX.Y.Z
    gh release create vX.Y.Z --verify-tag --title vX.Y.Z --notes-file notes.md
    

    Push the tag with git first. Creating it through the API (gh release create --target) returned 404 for an admin token without the workflow scope when v1.0.0 was cut.

  • A RuboCop rule change needs a hand. If a release changes rubocop/base.yml or rubocop/cops/, the hashes in ruby-ci.yml change with it, and a repo's lint fails until its .rubocop/ copies match. Dependabot only moves the pin, so its bump PR goes red. Say so in the release notes, and push the copied files to each bump PR.

Gem versions follow lich-5

lich-5 is the reference for gem versions. Every other Ruby repo locks the gems it shares with lich-5 at lich-5's versions, with the same Bundler (BUNDLED WITH), the same PLATFORMS list and the same .ruby-version. Gems a repo has that lich-5 doesn't are its own business.

  • To change a shared gem, Bundler or Ruby, change lich-5 first. When that merges, align each other repo by running this in it and committing the result:

    curl -fsSL https://raw.githubusercontent.com/elanthia-online/.github/main/bin/sync-lockfile | ruby -
    

    It needs lich-5's Bundler version installed and prints the gem install command if it isn't.

  • Every repo that calls ruby-ci.yml gets the check as its lockfile job; lich-5 skips it, being the reference. A repo that needs to opt out passes lockfile-reference: ''. The job's lockfile-reference must be OWNER/REPO[@REF], and a file or directory by that name in the repo fails the check instead of standing in for the reference.

  • When the check fails, the job summary gives the command that fixes it, with the reference and directory that were checked.

  • On a pull request, the check fails only if the PR adds drift. A Dependabot bump of a shared gem fails, for example, because that fix belongs in lich-5. Drift the base branch already has is reported but doesn't fail, so a lich-5 update never blocks unrelated PRs.

  • On a push to the default branch, any drift fails.

  • lockfile-drift.yml checks every repo against lich-5's main daily, so a lich-5 update shows up here as a failed run for each repo it leaves behind. Add a repo to its list when it starts calling ruby-ci.yml.

About

Shared CI and repository standards for Elanthia Online projects

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages