Merge pull request #8766 from issyl0/brew-typecheck-ci

dev-cmd/typecheck: Group all automatic updates code into one \`--ci\` switch
This commit is contained in:
Issy Long 2020-09-21 09:39:36 +01:00 committed by GitHub
commit 5dbf31522f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 24 deletions

View File

@ -1,8 +1,8 @@
name: Update Tapioca definitions
name: Update Sorbet-related files
on:
push:
paths:
- .github/workflows/tapioca.yml
- .github/workflows/sorbet.yml
branches-ignore:
- master
schedule:
@ -26,7 +26,7 @@ jobs:
run: |
git fetch origin
BRANCH="tapioca-update"
BRANCH="sorbet-files-update"
echo "::set-output name=branch::${BRANCH}"
if git ls-remote --exit-code --heads origin "$BRANCH"; then
@ -37,9 +37,9 @@ jobs:
BRANCH_EXISTS="1"
fi
if brew typecheck --prune-files-list --update-definitions --fail-if-not-changed; then
if brew typecheck --update --fail-if-not-changed; then
git add "$GITHUB_WORKSPACE/Library/Homebrew/sorbet"
git commit -m "sorbet: update RBI files using Tapioca." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/tapioca.yml)."
git commit -m "sorbet: Update RBI files and prune files.yaml." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml)."
echo "::set-output name=committed::true"
if [ -n "$BRANCH_EXISTS" ]; then
echo "::set-output name=pull_request::true"

View File

@ -16,10 +16,8 @@ module Homebrew
EOS
switch "-q", "--quiet",
description: "Silence all non-critical errors."
switch "--update-definitions",
description: "Update Tapioca gem definitions of recently bumped gems"
switch "--prune-files-list",
description: "Remove deleted filepaths from #{SORBET_FILES_YAML}"
switch "--update",
description: "Update RBI files and prune #{SORBET_FILES_YAML}"
switch "--fail-if-not-changed",
description: "Return a failing status code if all gems are up to date " \
"and gem definitions do not need a tapioca update"
@ -41,7 +39,8 @@ module Homebrew
Homebrew.install_bundler_gems!
HOMEBREW_LIBRARY_PATH.cd do
if args.prune_files_list?
if args.update?
ohai "Checking for deleted filenames in #{SORBET_FILES_YAML}..."
lines_to_keep = []
sorbet_keywords = ["true:", "false:", "strict:", "strong:"]
@ -52,12 +51,11 @@ module Homebrew
filepath = line.split(" ").last
lines_to_keep << line if File.exist?(filepath)
end
end
File.write(SORBET_FILES_YAML, "#{lines_to_keep.join("\n")}\n")
end
if args.update_definitions?
ohai "Updating Tapioca RBI files..."
system "bundle", "exec", "tapioca", "sync"
system "bundle", "exec", "srb", "rbi", "hidden-definitions"
system "bundle", "exec", "srb", "rbi", "todo"

View File

@ -1244,10 +1244,8 @@ Check for typechecking errors using Sorbet.
* `-q`, `--quiet`:
Silence all non-critical errors.
* `--update-definitions`:
Update Tapioca gem definitions of recently bumped gems
* `--prune-files-list`:
Remove deleted filepaths from sorbet/files.yaml
* `--update`:
Update RBI files and prune sorbet/files.yaml
* `--fail-if-not-changed`:
Return a failing status code if all gems are up to date and gem definitions do not need a tapioca update
* `--dir`:

View File

@ -1718,12 +1718,8 @@ Check for typechecking errors using Sorbet\.
Silence all non\-critical errors\.
.
.TP
\fB\-\-update\-definitions\fR
Update Tapioca gem definitions of recently bumped gems
.
.TP
\fB\-\-prune\-files\-list\fR
Remove deleted filepaths from sorbet/files\.yaml
\fB\-\-update\fR
Update RBI files and prune sorbet/files\.yaml
.
.TP
\fB\-\-fail\-if\-not\-changed\fR