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

main #356

Merged
merged 20 commits into from
Jun 11, 2022
Merged

main #356

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
8 changes: 3 additions & 5 deletions .github/scripts/copy_to_versioned.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#!/usr/bin/env bash

git push

echo "Open PR to versioned branch (or not, if it was already there)"
echo ""
echo "Skipping failure here too, becuase we don't actually care"
echo "if the PR is already there."
gh pr create -f --head main --base versioned || true

echo "This ensures we have our commits pushed. We could be up to date"
echo "already. But it doesn't really matter."
git push || true
gh pr create -f --base versioned || git push -f

echo "Setting PR to merge automatically..."
gh pr merge --auto --merge
13 changes: 13 additions & 0 deletions .github/scripts/fix_any_failing_fixable_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
BAZEL_CMD="${BAZEL_CMD:-yarn -s run bazel}"

FIXER_TARGETS=$($BAZEL_CMD test \
--test_summary=terse \
--test_tag_filters=fixable \
$@ //... | \
awk '{print $1}' | \
sed 's/$/.fix/g' | \
sed -n '/^\/\//p' )

# Run all fixers
$BAZEL_CMD run $FIXER_TARGETS
27 changes: 25 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
~/.cache/bazelisk
~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-name }}
- name: All tests
- name: Special 'versioned' branch tests
run: bazelisk test //... --test_tag_filters=do_not_run_on_main

deployment:
Expand Down Expand Up @@ -129,7 +129,30 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: ./.github/scripts/copy_to_versioned.sh
- name: Restore bazel cache
uses: actions/[email protected]
env:
cache-name: bazel-cache
with:
path: |
~/.cache/bazelisk
~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-name }}
- name: Run all tests that are fixable, and perform fixes.
# bash prefix just because vscode for web can't chmod
run: bash ./.github/scripts/fix_any_failing_fixable_tests.sh --test_tag_filters=do_not_run_on_main
env:
BAZEL_CMD: bazelisk
- name: Run special 'versioned' branch tests
run: bazelisk test //... --test_tag_filters=do_not_run_on_main
- name: Commit any changes
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -am "Automatic fixes."
- name: Copy to versioned branch
run: ./.github/scripts/copy_to_versioned.sh
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
7 changes: 6 additions & 1 deletion bzl/versioning/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def bump_on_change_test(name, srcs = [], version_lock = None, version = None, ru
name = name,
generated = hashes_name,
src = version_lock,
tags = tags + ["version_check"],
tags = tags + ["version_check", "fixable"],
)

py_binary(
Expand All @@ -81,3 +81,8 @@ def bump_on_change_test(name, srcs = [], version_lock = None, version = None, ru
"$(rootpath " + version_lock + ")",
],
)

native.alias(
name = name + ".fix",
actual = name + ".bump",
)