Skip to content
Snippets Groups Projects
Unverified Commit 5dbf3152 authored by Issy Long's avatar Issy Long Committed by GitHub
Browse files

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

dev-cmd/typecheck: Group all automatic updates code into one \`--ci\` switch
parents cd4a3c05 189d10b3
No related branches found
No related tags found
No related merge requests found
name: Update Tapioca definitions name: Update Sorbet-related files
on: on:
push: push:
paths: paths:
- .github/workflows/tapioca.yml - .github/workflows/sorbet.yml
branches-ignore: branches-ignore:
- master - master
schedule: schedule:
...@@ -26,7 +26,7 @@ jobs: ...@@ -26,7 +26,7 @@ jobs:
run: | run: |
git fetch origin git fetch origin
BRANCH="tapioca-update" BRANCH="sorbet-files-update"
echo "::set-output name=branch::${BRANCH}" echo "::set-output name=branch::${BRANCH}"
if git ls-remote --exit-code --heads origin "$BRANCH"; then if git ls-remote --exit-code --heads origin "$BRANCH"; then
...@@ -37,9 +37,9 @@ jobs: ...@@ -37,9 +37,9 @@ jobs:
BRANCH_EXISTS="1" BRANCH_EXISTS="1"
fi 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 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" echo "::set-output name=committed::true"
if [ -n "$BRANCH_EXISTS" ]; then if [ -n "$BRANCH_EXISTS" ]; then
echo "::set-output name=pull_request::true" echo "::set-output name=pull_request::true"
......
...@@ -16,10 +16,8 @@ module Homebrew ...@@ -16,10 +16,8 @@ module Homebrew
EOS EOS
switch "-q", "--quiet", switch "-q", "--quiet",
description: "Silence all non-critical errors." description: "Silence all non-critical errors."
switch "--update-definitions", switch "--update",
description: "Update Tapioca gem definitions of recently bumped gems" description: "Update RBI files and prune #{SORBET_FILES_YAML}"
switch "--prune-files-list",
description: "Remove deleted filepaths from #{SORBET_FILES_YAML}"
switch "--fail-if-not-changed", switch "--fail-if-not-changed",
description: "Return a failing status code if all gems are up to date " \ description: "Return a failing status code if all gems are up to date " \
"and gem definitions do not need a tapioca update" "and gem definitions do not need a tapioca update"
...@@ -41,7 +39,8 @@ module Homebrew ...@@ -41,7 +39,8 @@ module Homebrew
Homebrew.install_bundler_gems! Homebrew.install_bundler_gems!
HOMEBREW_LIBRARY_PATH.cd do 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 = [] lines_to_keep = []
sorbet_keywords = ["true:", "false:", "strict:", "strong:"] sorbet_keywords = ["true:", "false:", "strict:", "strong:"]
...@@ -52,12 +51,11 @@ module Homebrew ...@@ -52,12 +51,11 @@ module Homebrew
filepath = line.split(" ").last filepath = line.split(" ").last
lines_to_keep << line if File.exist?(filepath) lines_to_keep << line if File.exist?(filepath)
end end
end
File.write(SORBET_FILES_YAML, "#{lines_to_keep.join("\n")}\n") File.write(SORBET_FILES_YAML, "#{lines_to_keep.join("\n")}\n")
end end
if args.update_definitions? ohai "Updating Tapioca RBI files..."
system "bundle", "exec", "tapioca", "sync" system "bundle", "exec", "tapioca", "sync"
system "bundle", "exec", "srb", "rbi", "hidden-definitions" system "bundle", "exec", "srb", "rbi", "hidden-definitions"
system "bundle", "exec", "srb", "rbi", "todo" system "bundle", "exec", "srb", "rbi", "todo"
......
...@@ -1244,10 +1244,8 @@ Check for typechecking errors using Sorbet. ...@@ -1244,10 +1244,8 @@ Check for typechecking errors using Sorbet.
* `-q`, `--quiet`: * `-q`, `--quiet`:
Silence all non-critical errors. Silence all non-critical errors.
* `--update-definitions`: * `--update`:
Update Tapioca gem definitions of recently bumped gems Update RBI files and prune sorbet/files.yaml
* `--prune-files-list`:
Remove deleted filepaths from sorbet/files.yaml
* `--fail-if-not-changed`: * `--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 Return a failing status code if all gems are up to date and gem definitions do not need a tapioca update
* `--dir`: * `--dir`:
......
...@@ -1718,12 +1718,8 @@ Check for typechecking errors using Sorbet\. ...@@ -1718,12 +1718,8 @@ Check for typechecking errors using Sorbet\.
Silence all non\-critical errors\. Silence all non\-critical errors\.
. .
.TP .TP
\fB\-\-update\-definitions\fR \fB\-\-update\fR
Update Tapioca gem definitions of recently bumped gems Update RBI files and prune sorbet/files\.yaml
.
.TP
\fB\-\-prune\-files\-list\fR
Remove deleted filepaths from sorbet/files\.yaml
. .
.TP .TP
\fB\-\-fail\-if\-not\-changed\fR \fB\-\-fail\-if\-not\-changed\fR
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment