Skip to content
Merged
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
15 changes: 0 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

# Sets TRAVIS_PULL_REQUEST to false if this is not a pull request.
- name: set TRAVIS_PULL_REQUEST
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: echo "TRAVIS_PULL_REQUEST=${PR_NUMBER:-false}" >> $GITHUB_ENV

- name: Fetch configlet
run: ./bin/fetch-configlet

Expand Down Expand Up @@ -93,16 +87,7 @@ jobs:
toolchain: ${{ matrix.rust }}
default: true

# Sets TRAVIS_PULL_REQUEST to false if this is not a pull request.
- name: set TRAVIS_PULL_REQUEST
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: echo "TRAVIS_PULL_REQUEST=${PR_NUMBER:-false}" >> $GITHUB_ENV

# run scripts as steps
# TODO: the TRAVIS_PULL_REQUEST variable is a holdover from before the
# migration to GitHub Actions. The scripts that use it do so in order to
# run only on changed files.
- name: Check exercises
env:
DENYWARNINGS: ${{ matrix.deny_warnings }}
Expand Down
19 changes: 7 additions & 12 deletions _test/check-configlet-fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@
# Check if config.json or maintainers.json were modified
check_pattern="config.json\|config/maintainers.json"

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
# Check the changes on the current branch against master branch
git diff --name-only remotes/origin/master | grep "$check_pattern"
else
# Check the commits on the master branch made during the week
# This is because Travis cron is set to test the master branch weekly.
git diff --name-only "@{7 days ago}" | grep "$check_pattern"
fi

if [ $? != 0 ]; then
echo "config.json or maintainers.json were not changed - configlet fmt is aborted."

exit 0
if ! git diff --name-only remotes/origin/master | grep -q "$check_pattern"; then
echo "config.json or maintainers.json were not changed - configlet fmt is aborted."
exit 0
fi
fi
# If it's not a pull request, just always run it.
# This script is cheap anyway.

repo=$(cd "$(dirname "$0")/.." && pwd)
configlet="${repo}/bin/configlet"
Expand Down
23 changes: 12 additions & 11 deletions _test/check-exercise-crate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@

EXERCISE_CRATE_PATH="util/exercise"

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
# Check the changes on the current branch against master branch
git diff --name-only remotes/origin/master | grep "$EXERCISE_CRATE_PATH"
else
# Check the commits on the master branch made during the week
# This is because Travis cron is set to test the master branch weekly.
git diff --name-only "@{7 days ago}" | grep "$EXERCISE_CRATE_PATH"
if ! git diff --name-only remotes/origin/master | grep -q "$EXERCISE_CRATE_PATH"; then
echo "exercise crate was not modified. The script is aborted."
exit 0
fi
fi
# If it's not a pull request, just always run it.
# Two scenarios:
# 1. It's being run locally,
# in which case we assume the person running it really does want to run it.
# 2. It's being run on CI for master,
# in which case we should check regardless of changes to exercise crate,
# in case there's a new toolchain release, etc.

if [ $? != 0 ]; then
echo "exercise crate was not modified. The script is aborted."

exit 0
fi

TRACK_ROOT="$(git rev-parse --show-toplevel)"

Expand Down
2 changes: 1 addition & 1 deletion _test/check-exercises.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi

repo=$(cd "$(dirname "$0")/.." && pwd)

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
files="$(git diff --diff-filter=d --name-only remotes/origin/master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')"
else
files=$repo/exercises/*
Expand Down
2 changes: 1 addition & 1 deletion _test/ensure-stubs-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

repo=$(cd "$(dirname "$0")/.." && pwd)

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
changed_exercises="$(git diff --diff-filter=d --name-only remotes/origin/master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')"
else
changed_exercises=$repo/exercises/*
Expand Down