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

DO NOT MERGE: travis: Run Clippy #445

Closed
wants to merge 3 commits into from
Closed
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
120 changes: 15 additions & 105 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- clippy
pull_request:

jobs:
Expand All @@ -13,137 +14,46 @@ jobs:
runs-on: ubuntu-latest

steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2

- name: Ensure src/lib.rs files exist
run: bash ./_test/ensure-lib-src-rs-exist.sh

- name: Count ignores
run: sh ./_test/count-ignores.sh

- name: Check UUIDs
run: sh ./_test/check-uuids.sh

- name: Verify exercise difficulties
run: ./_test/verify-exercise-difficulties.sh

- name: Check exercises for authors
run: ./_test/check-exercises-for-authors.sh

- name: True
run: /bin/true
configlet:
name: Setup configlet
runs-on: ubuntu-latest

steps:
# Checks out master locally so that it is available to the scripts.
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master

# Checks out a copy of your repository on the ubuntu-latest machine
- 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

- name: Check configlet format
run: ./_test/check-configlet-fmt.sh

- name: Ensure readmes are updated
run: sh ./_test/ensure-readmes-are-updated.sh

- name: Lint configlet
run: ./bin/configlet lint .


- name: True
run: /bin/true
compilation:
name: Check compilation
runs-on: ubuntu-latest

strategy:
# Allows running the job multiple times with different configurations
matrix:
rust: ["stable", "beta"]
deny_warnings: ['', '1']

steps:
# Checks out master locally so that it is available to the scripts.
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master

# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2

- name: Setup toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
toolchain: stable
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
- name: Install Clippy
run: rustup component add clippy

# 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
- name: Clippy on Tests
env:
DENYWARNINGS: ${{ matrix.deny_warnings }}
CLIPPY: tests
run: ./_test/check-exercises.sh
continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}

- name: Ensure stubs compile
- name: Clippy on Libs
env:
DENYWARNINGS: ${{ matrix.deny_warnings }}
run: sh ./_test/ensure-stubs-compile.sh
continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}

- name: Check exercise crate
env:
DENYWARNINGS: ${{ matrix.deny_warnings }}
run: sh ./_test/check-exercise-crate.sh
continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}

CLIPPY: lib
run: ./_test/check-exercises.sh
nightly-compilation:
name: Check exercises on nightly (benchmark enabled)
runs-on: ubuntu-latest
continue-on-error: true # It's okay if the nightly job fails

steps:
# Checks out master locally so that it is available to the scripts.
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master

# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2

- name: Setup nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true

- name: Check exercises
env:
BENCHMARK: '1'
run: ./_test/check-exercises.sh
- name: True
run: /bin/true
6 changes: 3 additions & 3 deletions _test/check-exercises.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ if [ ! -x "./bin/test-exercise" ]; then
exit 1
fi

# In DENYWARNINGS mode, do not set -e so that we run all tests.
# In DENYWARNINGS or CLIPPY mode, do not set -e so that we run all tests.
# This allows us to see all warnings.
if [ -z "$DENYWARNINGS" ]; then
if [ -z "$DENYWARNINGS$CLIPPY" ]; then
set -e
fi

Expand All @@ -27,7 +27,7 @@ fi

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

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if false; 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: 2 additions & 0 deletions bin/test-exercise
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ fi
# what cargo command will we use?
if [ -n "$BENCHMARK" ]; then
command="bench"
elif [ -n "$CLIPPY" ]; then
command="clippy --$CLIPPY"
else
command="test"
fi
Expand Down