Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1 Automation #101

Open
wants to merge 26 commits into
base: v1-machines
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
86e17bf
Add V1 workflows
Dec 23, 2019
fee18c7
Add SKR 1.3 dual endstop version
Dec 24, 2019
891eef0
Make config generation errors fatal
Dec 24, 2019
a33b58d
Fix local usage of v1-scripts/pull-from-upstream
Dec 24, 2019
eadd73a
Fix PIO environment for Rambo boards
Dec 24, 2019
6c23395
Move Marlin to a git sub-module
Dec 26, 2019
db6541f
Add a dual endstop config for SKR Pro 1.1
Dec 29, 2019
a18338d
Add configs for 2.0.x and dev-2.1.x branches
Dec 29, 2019
3870c5d
Add readme and provide double check in script
dolfelt Jan 5, 2020
3c477d5
My current Base config
V1EngineeringInc Jan 26, 2020
7c6e897
Enable helical plunge with arcs (P circles) and CNC workplanes
Jan 20, 2020
9a16712
Remove already merged PRs from bugfix-2.0.x build
Feb 10, 2020
1f37638
Ditch the hand-edited base config and switch to 100% generated
Feb 10, 2020
68d904e
Correct stepper type for Archim2 board
Jan 20, 2020
f95f998
Fix build error with latest upstream (build_marlin_pio script was rem…
Feb 10, 2020
42ccd27
Delete upstream workflows on pull
Feb 10, 2020
bba1ac8
Handle fallout from upstream's config repository split
Feb 10, 2020
8c744cc
Rename dual-endstops to dual-drivers-on-xy
Feb 10, 2020
790112d
Update BTT board names
Feb 10, 2020
ef749ac
Added single-axis config for SKR1.3
Feb 10, 2020
0badd3a
Added SKR1.3 configuration for Lowrider dual driver setup
Feb 16, 2020
8937e6d
Rename megaatmega2560 to mega2560 to accomodate upstream changes
May 25, 2020
99b7df6
Add TMC2209 support and sensorless config for SKR1.3 lowrider
May 23, 2020
a2c5fed
Add support for TMC5160 drivers
May 25, 2020
1ece46c
Publish an STL for Lowrider2 sensorless Z- homing
Jul 31, 2020
e06c3de
Publish Coupling saver STL
Aug 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/scripts/configure-git
@@ -0,0 +1,11 @@
# Magic from https://github.com/actions/checkout#Checkout-submodules
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git config --global protocol.version 2
git config --global http.extraheader "$auth_header"

# Commit identity
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"

# Other settings
git config --global advice.detachedHead false
139 changes: 139 additions & 0 deletions .github/workflows/v1-builds.yml
@@ -0,0 +1,139 @@
name: V1 Builds

on:
schedule:
# On 45-th minute, every 6 hours
- cron: '45 */6 * * *'

push:
branches:
- 'v1-**'
paths-ignore:
- data/**
- docs/**
- '**/*.md'
# pull_request:
# branches:
# - 'v1-**'
# paths-ignore:
# - data/**
# - docs/**
# - '**/*.md'

jobs:
generate:
name: Generate v1-bugfix-2.0.x
runs-on: ubuntu-latest

env:
BUILD_BRANCH: v1-bugfix-2.0.x

steps:
- uses: actions/checkout@v2
- run: .github/scripts/configure-git
- name: Check out submodules
run: |
(cd MarlinFirmware && ../v1-scripts/fetch-branch "origin/$BUILD_BRANCH")
git submodule sync --recursive
git submodule update --init --force --recursive --remote

- name: Generate
run: |
v1-scripts/reset-to-manifest
v1-scripts/generate-configs
v1-scripts/commit-configs

# Based on .github/workflows/test-builds.yml
- name: Select Python 3.7
uses: actions/setup-python@v1
with:
python-version: '3.7' # 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 https://github.com/platformio/platformio-core/archive/master.zip
platformio update

- name: Check
run: |
#v1-scripts/diff-branches "$BUILD_BRANCH" "origin/$BUILD_BRANCH" && exit 0 # No changes
v1-scripts/build-for-machine MPCNC/Rambo_T8_16T_LCD_DualEndstop

- name: Push
if: github.event_name != 'pull_request'
run: |
cd MarlinFirmware
git rm .github/workflows/*
git commit -m 'Delete github workflows'
git push origin "HEAD:refs/heads/$BUILD_BRANCH" --force

build:

name: ${{ matrix.machine }}
runs-on: ubuntu-latest
needs: generate

env:
BUILD_BRANCH: v1-bugfix-2.0.x

strategy:
fail-fast: false # Allow all machines to finish building
matrix:
machine:
- MP3DP/MRambo_16T_aero
- MP3DP/Ramps_16T_MK
#- MPCNC/Archim1_T8_16T_LCD
#- MPCNC/Archim1_T8_16T_LCD_DualEndstop
#- MPCNC/Archim2_T8_16T_LCD_16step
- MPCNC/MRambo_T8_16T_LCD
- MPCNC/Rambo_T8_16T_LCD
- MPCNC/Rambo_T8_16T_LCD_DualEndstop
- MPCNC/Ramps_T8_16T_LCD_32step
- MPCNC/Ramps_T8_16T_LCD_32step_DualEndstop
- MPCNC/SKR1.3_T8_16T_LCD_32step
- MPCNC/SKR1.3_T8_16T_LCD_32step_DualEndstop
- MPCNC/SKRPro1.1_T8_16T_LCD_32step_DualEndstop
- ZenXY/MiniRambo_16T
- ZenXY/Ramps_16T_LCD_32
- Lowrider/SKR1.3_T8_16T_LCD_32step_DualDrivers

steps:
- uses: actions/checkout@v2
- run: .github/scripts/configure-git
- name: Check out submodules
run: |
(cd MarlinFirmware && ../v1-scripts/fetch-branch "origin/$BUILD_BRANCH")
git submodule sync --recursive
git submodule update --init --force --recursive --remote

# Based on .github/workflows/test-builds.yml
- name: Select Python 3.7
uses: actions/setup-python@v1
with:
python-version: '3.7' # 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 https://github.com/platformio/platformio-core/archive/master.zip
platformio update

- name: Build
run: |
v1-scripts/build-for-machine ${{ matrix.machine }}
v1-scripts/build-zips ${{ matrix.machine }}

- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: ".zip/*.zip,.bin/*"
#bodyFile: "body.md"
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
name: unstable
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will always go to the same release, right? There won't be a way to get a previous unstable branch?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these build products also available in the build log?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too happy with existing release plugins. It starts to look like we may have to build one.

In principle one can upload artifacts from build steps that can then be downloaded from the steps. But this is difficult to find/use and it's not designed for long-term storage.

If there is a need to keep a longer history of nightlies these must be published as releases. Which means there must be some cleanup logic to prune these.

# FIXME: This needs to be dynamic and possibly use a different action
# e.g. https://github.com/actions/create-release/pull/12
tag: v1-bugfix-2.0.x-auto
commit: ${{ github.ref }}
allowUpdates: true
73 changes: 73 additions & 0 deletions .github/workflows/v1-pull.yml
@@ -0,0 +1,73 @@
name: V1 pull from MarlinFirmware

on:
schedule:
# On 15-th minute, every 6 hours
- cron: '15 */6 * * *'

push:
branches:
- 'v1-machines**'
paths:
- '.github/workflows/v1-pull.yml'
- '.github/scripts'
- 'v1-scripts/**'
- 'MarlinFirmware'
- '!v1-scripts/config/**'

pull_request:
branches:
- 'v1-machines**'
paths:
- '.github/workflows/v1-pull.yml'
- '.github/scripts'
- 'v1-scripts/**'
- 'MarlinFirmware'
- '!v1-scripts/config/**'

jobs:

pull:
name: Pull from bugfix-2.0.x
runs-on: ubuntu-latest

env:
UPSTREAM_BRANCH: bugfix-2.0.x

steps:
- uses: actions/checkout@v2
- run: .github/scripts/configure-git
- name: Check out submodules
run: |
git submodule sync --recursive
git submodule update --init --force --recursive --depth=1

- name: Pull
run: |
v1-scripts/fetch-branch "origin/v1-$UPSTREAM_BRANCH"
v1-scripts/pull-from-upstream

# Based on .github/workflows/test-builds.yml
- name: Select Python 3.7
uses: actions/setup-python@v1
with:
python-version: '3.7' # 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 https://github.com/platformio/platformio-core/archive/master.zip
platformio update

- name: Check
run: |
#v1-scripts/diff-branches ... "origin/v1-$UPSTREAM_BRANCH" && exit 0 # No changes
v1-scripts/build-for-machine MPCNC/Rambo_T8_16T_LCD_DualEndstop

- name: Push
if: github.event_name != 'pull_request'
run: |
cd MarlinFirmware
git rm .github/workflows/*
git commit -m 'Delete github workflows'
git push origin "HEAD:refs/heads/v1-$UPSTREAM_BRANCH" --force
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
/.bin
/.zip
4 changes: 4 additions & 0 deletions .gitmodules
@@ -0,0 +1,4 @@
[submodule "MarlinFirmware"]
path = MarlinFirmware
url = ./
branch = v1-bugfix-2.0.x
Binary file added Lowrider2_Coupling_Saver_D19L25.stl
Binary file not shown.
Binary file added Lowrider2_Z_Hard_Stop_Spacer.stl
Binary file not shown.
1 change: 1 addition & 0 deletions MarlinFirmware
Submodule MarlinFirmware added at 14ab8c
35 changes: 35 additions & 0 deletions README.md
@@ -0,0 +1,35 @@
# V1 Engineering Preconfigured Marlin

This repository provides a preconfigured version of Marlin that is optimized for CNC and milling purposes.

## Getting started

TODO: Possibly links to download pre-built firmware.

## Building V1 Marlin

These scripts require the PlatformIO CLI and GNU `sed`

[Install PlatformIO](https://docs.platformio.org/en/latest/installation.html)

In order to generate the configuration you must first pull the Marlin submodule

```
git submodule update --init --recursive
```

Then generate the example configuration using the following script

```
UPSTREAM_BRANCH=2.0.x ./v1-scripts/pull-from-upstream
```

Then generate a firmware file by running

```
./v1-scripts/build-for-machine machine-name
```

Machine names are based on the folder and filename within `v1-scripts/configs`. For example, for the Archim board you would use `MPCNC/Archim1_T8_16T_LCD`.

The firmware file will be located in the `MarlinFirmware/.pio` directory.
3 changes: 3 additions & 0 deletions v1-scripts/branch-exists
@@ -0,0 +1,3 @@
#!/bin/bash

git show-ref --quiet --verify "refs/heads/$1"
23 changes: 23 additions & 0 deletions v1-scripts/build-for-machine
@@ -0,0 +1,23 @@
#!/bin/bash

set -ex

. $(dirname "$0")/env

machine=$1
shift

[ "$machine" ] || exit 2

eval $($V1_ROOT/$CFGDIR/build-settings.py "$machine")

cd "$V1_ROOT/$MARLINDIR"
export PATH=$PATH:buildroot/bin

restore_configs

for f in config/examples/$machine/{Configuration.h,Configuration_adv.h,_Bootscreen.h,_Statusscreen.h}; do
[ -f "$f" ] && cp "$f" Marlin/
done

platformio run --project-dir . -e "$env" --silent "$@"
21 changes: 21 additions & 0 deletions v1-scripts/build-zips
@@ -0,0 +1,21 @@
#!/bin/bash

set -ex

. $(dirname "$0")/env

machine=$1
[ "$machine" ] || exit 2
eval $($V1_ROOT/$CFGDIR/build-settings.py "$machine")

flatname=$(echo "$machine" | sed 's@/@_@g')
dirname="$flatname"

cd "$V1_ROOT"

mkdir -p .bin
cp "$MARLINDIR/.pio/build/$env/$out" ".bin/$flatname.$out"

mkdir -p .zip
ln -sf "$V1_ROOT/$MARLINDIR" ".zip/$dirname-src"
(cd ".zip" && zip -prq "$flatname-src.zip" "$dirname-src"/*)
9 changes: 9 additions & 0 deletions v1-scripts/commit-configs
@@ -0,0 +1,9 @@
#!/bin/bash

set -ex

. $(dirname "$0")/env

cd "$V1_ROOT/$MARLINDIR"
git add config/examples
git commit -m 'Add configuratons for V1 machines'
22 changes: 22 additions & 0 deletions v1-scripts/configs/Lowrider/SKR1.3_T8_16T_LCD_32step_DualDrivers
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

incdir=$(dirname $0)/..

restore_configs
opt_enable SHOW_CUSTOM_BOOTSCREEN

. $incdir/base-cnc-config
. $incdir/drv8825
. $incdir/dual-drivers-on-yz

opt_set MOTHERBOARD BOARD_BTT_SKR_V1_3
opt_set SERIAL_PORT "-1"

opt_set DEFAULT_AXIS_STEPS_PER_UNIT "{ 200, 200, 800, 200 }"
opt_enable REVERSE_ENCODER_DIRECTION
opt_enable MIN_SOFTWARE_ENDSTOP_Z

# Lowrider gantry will drop for sure if Z is powered off
opt_set DISABLE_INACTIVE_Z "false"