Add pr-size and stale actions.
parent
063130726a
commit
d68efb994e
|
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
MESSAGE=$1
|
||||||
|
BASE_DIR=$2
|
||||||
|
PR_DIR=$3
|
||||||
|
shift 3
|
||||||
|
|
||||||
|
# this assumes we're running from the repository root
|
||||||
|
AVR_SIZE=$(echo .dependencies/avr-gcc-*/bin/avr-size)
|
||||||
|
test -x "$AVR_SIZE" || exit 2
|
||||||
|
|
||||||
|
avr_size()
|
||||||
|
{
|
||||||
|
"$AVR_SIZE" --mcu=atmega2560 -C "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
avr_flash()
|
||||||
|
{
|
||||||
|
avr_size "$@" | sed -ne 's/^Program: *\([0-9]\+\).*/\1/p'
|
||||||
|
}
|
||||||
|
|
||||||
|
avr_ram()
|
||||||
|
{
|
||||||
|
avr_size "$@" | sed -ne 's/^Data: *\([0-9]\+\).*/\1/p'
|
||||||
|
}
|
||||||
|
|
||||||
|
cat <<EOF > "$MESSAGE"
|
||||||
|
| ΔFlash (bytes) | ΔSRAM (bytes) |
|
||||||
|
| -------------- | ------------- |
|
||||||
|
EOF
|
||||||
|
|
||||||
|
base_bin=$(echo ${BASE_DIR}/firmware)
|
||||||
|
base_flash=$(avr_flash "$base_bin")
|
||||||
|
base_ram=$(avr_ram "$base_bin")
|
||||||
|
|
||||||
|
pr_bin=$(echo ${PR_DIR}/firmware)
|
||||||
|
pr_flash=$(avr_flash "$pr_bin")
|
||||||
|
pr_ram=$(avr_ram "$pr_bin")
|
||||||
|
|
||||||
|
flash_d=$(($pr_flash - $base_flash))
|
||||||
|
ram_d=$(($pr_ram - $base_ram))
|
||||||
|
|
||||||
|
echo "| $flash_d | $ram_d |" >> "$MESSAGE"
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
name: pr-size
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
branches: [ main, MMU_* ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
TARGETS: "firmware"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
# setup base required dependencies
|
||||||
|
- name: Setup dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get install cmake ninja-build python3-pyelftools python3-regex python3-polib
|
||||||
|
|
||||||
|
# build the base branch
|
||||||
|
- name: Checkout base
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup build dependencies
|
||||||
|
run: |
|
||||||
|
./utils/bootstrap.py
|
||||||
|
|
||||||
|
- name: Build base
|
||||||
|
run: |
|
||||||
|
rm -rf build-base
|
||||||
|
mkdir build-base
|
||||||
|
cd build-base
|
||||||
|
cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||||
|
ninja
|
||||||
|
|
||||||
|
# save pr-size for later use
|
||||||
|
- name: Save base data
|
||||||
|
run: |
|
||||||
|
cp -f ./.github/workflows/pr-size.sh build-base
|
||||||
|
|
||||||
|
# build the PR branch
|
||||||
|
- name: Checkout PR
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
clean: false
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Build PR
|
||||||
|
run: |
|
||||||
|
rm -rf build-pr
|
||||||
|
mkdir build-pr
|
||||||
|
cd build-pr
|
||||||
|
cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||||
|
ninja
|
||||||
|
|
||||||
|
# extract/show build differences
|
||||||
|
- name: Calculate binary changes
|
||||||
|
run: |
|
||||||
|
rm -rf build-changes
|
||||||
|
./build-base/pr-size.sh build-changes build-base build-pr
|
||||||
|
|
||||||
|
- name: Add PR Comment
|
||||||
|
uses: mshick/add-pr-comment@v2
|
||||||
|
with:
|
||||||
|
message-path: build-changes
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: Mark stale issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# 1:30 AM on MON/THU
|
||||||
|
- cron: "30 1 * * 1,2,3,4"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@v8
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# Don't ever mark PRs as stale.
|
||||||
|
days-before-pr-stale: -1
|
||||||
|
stale-issue-message: 'This issue has been flagged as stale because it has been open for 60 days with no activity. The issue will be closed in 7 days unless someone removes the "stale" label or adds a comment.'
|
||||||
|
close-issue-message: 'This issue has been closed due to lack of recent activity.'
|
||||||
|
# Don't act on things assigned to a milestone or assigned to someone.
|
||||||
|
exempt-all-milestones: true
|
||||||
|
exempt-all-assignees: true
|
||||||
|
enable-statistics: true
|
||||||
|
# Disable this and change the operations per run back to 30 when this goes live.
|
||||||
|
debug-only: false
|
||||||
|
operations-per-run: 30
|
||||||
|
stale-issue-label: 'stale-issue'
|
||||||
|
stale-pr-label: 'stale-pr'
|
||||||
|
ascending: true
|
||||||
Loading…
Reference in New Issue