Skip to content

Commit

Permalink
fix: distinguish build matrix build type from Makefile's BUILD_TYPE
Browse files Browse the repository at this point in the history
build-neon uses `make postgres-...`.

The Makefile expects BUILD_TYPE to be debug or release.

Before this PR, the build matrix's BUILD_TYPE would be just that.
Now the build matrix's build type is something different than the
Makefile's BUILD_TYPE.

Make the difference explicit.
  • Loading branch information
problame committed Apr 25, 2023
1 parent 031a304 commit f42aede
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ jobs:
strategy:
fail-fast: false
matrix:
build_type: [ debug, release, image ]
build_type:
- debug
- release
- image
env:
BUILD_TYPE: ${{ matrix.build_type }}
# NB: BUILD_TYPE != MATRIX_BUILD_TYPE; the former is a Makefile variable
MATRIX_BUILD_TYPE: ${{ matrix.build_type }}
GIT_VERSION: ${{ github.sha }}

steps:
Expand Down Expand Up @@ -181,18 +185,20 @@ jobs:
# corresponding Cargo.toml files for their descriptions.
- name: Set env variables
run: |
case "$BUILD_TYPE" in
case "$MATRIX_BUILD_TYPE" in
debug)
cov_prefix="scripts/coverage --profraw-prefix=$GITHUB_JOB --dir=/tmp/coverage run"
CARGO_FEATURES="--features testing"
CARGO_FLAGS="--locked"
TARGET_DIR_NAME="debug"
BUILD_TYPE="debug"
;;
release)
cov_prefix=""
CARGO_FEATURES="--features testing"
CARGO_FLAGS="--locked --release"
TARGET_DIR_NAME="release"
BUILD_TYPE="release"
;;
image)
# Like we do in the Dockerfile built by the neon-image stage.
Expand All @@ -202,9 +208,10 @@ jobs:
CARGO_FEATURES=""
CARGO_FLAGS="--locked --release"
TARGET_DIR_NAME="release"
BUILD_TYPE="release"
;;
*)
echo "Unknown BUILD_TYPE: $BUILD_TYPE"
echo "Unknown MATRIX_BUILD_TYPE: $MATRIX_BUILD_TYPE"
exit 1
;;
esac
Expand All @@ -213,6 +220,8 @@ jobs:
echo "CARGO_FLAGS=${CARGO_FLAGS}" >> $GITHUB_ENV
echo "CARGO_HOME=${GITHUB_WORKSPACE}/.cargo" >> $GITHUB_ENV
echo "TARGET_DIR_NAME=${TARGET_DIR_NAME}" >> $GITHUB_ENV
echo "MATRIX_BUILD_TYPE=${MATRIX_BUILD_TYPE}" >> $GITHUB_ENV
echo "BUILD_TYPE=${BUILD_TYPE}" >> $GITHUB_ENV
# Disabled for now
# Don't include the ~/.cargo/registry/src directory. It contains just
Expand Down Expand Up @@ -288,7 +297,7 @@ jobs:
done
# Install test executables and write list of all binaries (for code coverage)
if [[ $BUILD_TYPE == "debug" ]]; then
if [[ $MATRIX_BUILD_TYPE == "debug" ]]; then
# Keep bloated coverage data files away from the rest of the artifact
mkdir -p /tmp/coverage/
Expand All @@ -313,7 +322,7 @@ jobs:
done
else
if [ "$cov_prefix" != "" ]; then
echo "expecting coverage prefix to be empty for all build types except debug, got BUILD_TYPE=$BUILD_TYPE"
echo "expecting coverage prefix to be empty for all gh matrix build types except 'debug', got MATRIX_BUILD_TYPE=$MATRIX_BUILD_TYPE"
exit 1
fi
fi
Expand Down

0 comments on commit f42aede

Please sign in to comment.