Skip to content

Commit

Permalink
CI: Add workflow for CLI testing (qmk#7357)
Browse files Browse the repository at this point in the history
Create GitHub Actions cli test workflow and remove travis runs of 'qmk pytest'
  • Loading branch information
zvecr authored and fdidron committed Feb 14, 2020
1 parent ca466c6 commit ac61b30
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CLI CI

on:
push:
branches:
- master
- future
pull_request:
paths:
- 'lib/python/**'
- 'bin/qmk'
- 'requirements.txt'
- '.github/workflows/cli.yml'

jobs:
test:
runs-on: ubuntu-latest

container: qmkfm/base_container

steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Run tests
run: bin/qmk pytest
2 changes: 1 addition & 1 deletion lib/python/qmk/tests/test_cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_kle2json():


def test_doctor():
result = check_subcommand('doctor')
result = check_subcommand('doctor', '-n')
assert result.returncode == 0
assert 'QMK Doctor is checking your environment.' in result.stderr
assert 'QMK is ready to go' in result.stderr
Expand Down
15 changes: 2 additions & 13 deletions util/travis_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}"
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}"

# test force push
#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d"

NUM_IMPACTING_CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ecv '^(docs/)')
BRANCH=$(git rev-parse --abbrev-ref HEAD)
NUM_CORE_CHANGES=$(echo "$QMK_CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)' -e '^(util/)' -e '^(lib/python/)' -e '^(bin/qmk)' -e '^(requirements.txt)' -e '(.travis.yml)')

if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip test]"* ]]; then
echo "Skipping due to commit message"
Expand All @@ -19,11 +15,4 @@ if [ "$BRANCH" != "master" ] && [ "$NUM_IMPACTING_CHANGES" == "0" ]; then
exit 0
fi

# if docker is installed - call make within the qmk docker image
if command -v docker >/dev/null; then
function make() {
docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@"
}
fi

make test:all
exit $exit_code

0 comments on commit ac61b30

Please sign in to comment.