
`spack style` previously used a Travis CI variable to figure out what the base branch of a PR was, and this was apparently also set on `develop`. We switched to `GITHUB_BASE_REF` to support GitHub Actions, but it looks like this is set to `""` in pushes to develop, so `spack style` breaks there. This PR does two things: - [x] Remove `GITHUB_BASE_REF` knowledge from `spack style` entirely - [x] Handle `GITHUB_BASE_REF` in style scripts instead, and explicitly pass the base ref if it is present, but don't otherwise. This makes `spack style` *not* dependent on the environment and fixes handling of the base branch in the right place.
29 lines
639 B
Bash
Executable File
29 lines
639 B
Bash
Executable File
#!/bin/bash -e
|
|
#
|
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
|
#
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
#
|
|
# Description:
|
|
# Runs source code style checks on Spack.
|
|
# See $SPACK_ROOT/.flake8 for a list of
|
|
# approved exceptions.
|
|
#
|
|
# Usage:
|
|
# run-flake8-tests
|
|
#
|
|
. "$(dirname $0)/setup.sh"
|
|
|
|
BASE=""
|
|
if [ -n "$GITHUB_BASE_REF" ]; then
|
|
BASE="--base ${GITHUB_BASE_REF}"
|
|
fi
|
|
|
|
# verify that the code style is correct
|
|
spack style --root-relative $BASE
|
|
|
|
# verify that the license headers are present
|
|
spack license verify
|