🔧 No SDCARD_SORT_ALPHA on Creality CR-6 SE (for now) #482
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# build-pr.yml | |
# Build Marlin with the new / updated configs in the PR | |
# | |
name: PR Test Build | |
on: | |
pull_request: | |
branches: | |
- import-2.1.x | |
paths-ignore: | |
- '**/*.md' | |
jobs: | |
build: | |
name: Test Build | |
if: github.repository == 'MarlinFirmware/Configurations' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the PR | |
uses: actions/checkout@v4 | |
# Get the list of directories containing changed config files: | |
- name: Get changed directories | |
run: | | |
# Get the base branch of the Pull Request | |
BASE_BRANCH=$(jq -r .pull_request.base.ref <$GITHUB_EVENT_PATH) | |
# Get origin for comparison | |
git fetch --depth=1 origin $BASE_BRANCH | |
# Use `git diff` to get a list of folders with altered .h files | |
# between the current commit and the base branch of the Pull Request | |
DIRS=$(git diff --name-only --diff-filter=AMR origin/$BASE_BRANCH HEAD | grep -E ".+\.h" | while IFS= read -r f; do dirname "$f"; done | uniq) | |
# Exit if nothing testable changed | |
[[ -z $DIRS ]] && { echo "No Configuration changes detected."; exit ; } | |
# Set DIRS in the persistent environment | |
echo -e "DIRS<<EOF\n$DIRS\nEOF" >>$GITHUB_ENV | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache PlatformIO | |
uses: actions/cache@v4 | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
- name: Select Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' # Version range or exact version of a Python version to use, using semvers version range syntax. | |
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified | |
- name: Install PlatformIO | |
run: | | |
pip install -U platformio | |
pio upgrade --dev | |
pio pkg update --global | |
- name: Install Simulator dependencies | |
run: | | |
sudo apt-get install build-essential | |
sudo apt-get install libsdl2-dev | |
sudo apt-get install libsdl2-net-dev | |
sudo apt-get install libglm-dev | |
# Fetch the code from the other repo and compile it: | |
- name: Clone Marlin | |
run: | | |
git clone https://github.com/MarlinFirmware/Marlin.git | |
# For each directory containing a changed config file, copy the .h files and build the code: | |
- name: Test all changed config files | |
run: | | |
cd Marlin | |
IFS=$'\n' | |
for dir in $DIRS; do | |
# Copy all .h files from the directory into the Marlin subfolder | |
echo "Building Configurations in $dir ..." | |
cp ../"$dir"/*.h Marlin/ | |
# Suppress fatal warnings | |
echo -e "\n#define NO_CONTROLLER_CUSTOM_WIRING_WARNING" >> Marlin/Configuration.h | |
# Strip out #error lines so it can build | |
sed -i~ -e "20,30{/#error/d}" "Marlin/Configuration.h" | |
rm -f "Marlin/Configuration.h~" | |
# Build Marlin with PlatformIO | |
MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | sed 's/BOARD_//;s/\r//' ) | |
[[ -z $MB ]] && { echo "::error::Can't read MOTHERBOARD setting." ; exit 3; } | |
BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h ) | |
BNUM=$( sed -E 's/^.+BOARD_[^ ]+ +([0-9]+)(.|$)+$/\1/' <<<"$BLINE" ) | |
BDESC=$( sed -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" ) | |
[[ -z $BNUM ]] && { echo "::error::Can't find BOARD_$MB in core/boards.h." ; exit 3; } | |
if [ "$MB" == "SIMULATED" ] | |
then | |
ENVS=$"simulator_linux_release" | |
else | |
ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+env:[^ ]+" | grep -oE "env:[^ ]+" | sed -E "s/env://" ) ) | |
fi | |
[[ -z $ENVS ]] && { echo "::error::Can't find target(s) for $MB ($BNUM)." ; exit 3; } | |
[[ ${#ENVS[*]} == 1 ]] && TARGET=$ENVS || TARGET="${ENVS[0]}" | |
echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo | |
pio run -s -e $TARGET | |
# Reset the repo directory so the next iteration starts clean | |
git reset --hard HEAD | |
done |