Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c788c2e
First attempt at breaking out Travis CI into GitHub Actions
dgunay Oct 6, 2020
af8ddda
Rename actions to run all tests
dgunay Oct 6, 2020
a8b6d61
Rename missed name from GH actions template
dgunay Oct 6, 2020
91b831f
delete travis.yml
dgunay Oct 6, 2020
1e1bfb0
delete leftover commented out code from template
dgunay Oct 6, 2020
d56eab6
Run tests on pushes to master and pull requests
dgunay Oct 6, 2020
531120d
first attempt at recreating build matrix
dgunay Oct 6, 2020
7f695cd
Merge branch 'master' of github.com:dgunay/rust
dgunay Oct 6, 2020
d31adde
fix missing " in workflow
dgunay Oct 6, 2020
cb70645
attempt to fix special-case nightly include
dgunay Oct 6, 2020
742aa5f
another attempt at making the file lint
dgunay Oct 6, 2020
ab113cf
Merge work to fix problems in GitHub Actions CI (#1)
dgunay Oct 8, 2020
e037ed8
Squashed commit - should be pretty close to working as intended:
dgunay Oct 9, 2020
1e4d8c8
Merge branch 'master' of github.com:dgunay/rust
dgunay Oct 9, 2020
79e1c8e
remove leftover always true TRAVIS_PULL_REQUEST
dgunay Oct 9, 2020
ed3214c
break an example.rs impl to demo compilation failure
coriolinus Oct 15, 2020
d42e6dd
Revert "break an example.rs impl to demo compilation failure"
coriolinus Oct 15, 2020
91b3d69
remove an #[ignore] line to demo counting works
coriolinus Oct 15, 2020
c725aa2
Revert "remove an #[ignore] line to demo counting works"
coriolinus Oct 15, 2020
1ee4a74
change a README to demo configlet check failure
coriolinus Oct 15, 2020
6e5d05e
Revert "change a README to demo configlet check failure"
coriolinus Oct 15, 2020
a29a3f0
break benchmark to demo that it runs
coriolinus Oct 15, 2020
cca7fd3
Revert "break benchmark to demo that it runs"
coriolinus Oct 15, 2020
498d321
should pass CI again
coriolinus Oct 15, 2020
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
149 changes: 149 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Run all tests

# Run this workflow every time a new commit is pushed to the repository
on:
push:
branches:
- master
pull_request:

jobs:
ensure-conventions:
name: Ensure conventions are followed
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

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 .


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 }}
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 }}
run: ./_test/check-exercises.sh
continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}

- name: Ensure stubs compile
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' }}

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
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion _test/check-configlet-fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
# This ensures that config.json and config/maintainers.json are compatible
# with the output of configlet fmt.

# FIXME: causes failures in CI
# # Improve error propagation during CI
# set -e -o pipefail

# Check if config.json or maintainers.json were modified
check_pattern="config.json\|config/maintainers.json"

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Check the changes on the current branch against master branch
git diff --name-only master | grep "$check_pattern"
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.
Expand Down
6 changes: 5 additions & 1 deletion _test/check-exercise-crate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

# A script to ensure that the util/exercise crate builds after it was modified.

# FIXME: causes failures in CI
# # Improve error propagation during CI
# set -e -o pipefail

EXERCISE_CRATE_PATH="util/exercise"

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Check the changes on the current branch against master branch
git diff --name-only master | grep "$EXERCISE_CRATE_PATH"
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.
Expand Down
6 changes: 5 additions & 1 deletion _test/check-exercises.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# NOTE: this causes the job to fail always
# # Improve error propagation during CI
# set -e -o pipefail

# test for existence and executability of the test-exercise script
# this depends on that
if [ ! -f "./bin/test-exercise" ]; then
Expand Down Expand Up @@ -28,7 +32,7 @@ fi
repo=$(cd "$(dirname "$0")/.." && pwd)

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
files="$(git diff --diff-filter=d --name-only master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')"
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/*
fi
Expand Down
2 changes: 1 addition & 1 deletion _test/ensure-readmes-are-updated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ newline=$'\n '

missing_readmes=""
wrong_readmes=""
for exercise in $(git diff --diff-filter=d --name-only master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do
for exercise in $(git diff --diff-filter=d --name-only remotes/origin/master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do
echo "Checking readme for $exercise"
readme_path="exercises/${exercise}/README.md"
if [ ! -f $readme_path ]; then
Expand Down
6 changes: 5 additions & 1 deletion _test/ensure-stubs-compile.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/sh

# FIXME: causes failures in CI
# # Improve error propagation during CI
# set -e -o pipefail

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

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
changed_exercises="$(git diff --diff-filter=d --name-only master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')"
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/*
fi
Expand Down