Wait for serial before running speed tests #78
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
name: Update Schematic PDFs | |
on: | |
push: # Trigger for pushes. | |
branches: | |
- main | |
paths: | |
- hardware/** | |
- .github/workflows/update-schematic-pdfs.yaml | |
pull_request_target: # Trigger for pull requests, but in context of main. | |
types: [opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: # Allows for manual triggering. | |
# If another instance of this workflow is started for the same PR, cancel the | |
# old one. If a PR is updated and a new test run is started, the old test run | |
# will be cancelled automatically to conserve resources and to avoid a race | |
# updating the PR. | |
concurrency: | |
group: update-schematic-pdfs-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update: | |
name: Update Schematic PDFs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
# Get code from main to run the KiCad action, so it cannot be | |
# controlled by an attacker uploading a malicious PR. | |
ref: main | |
- name: Install KiCad | |
uses: ./.github/workflows/install-kicad | |
- name: Checkout PR | |
if: github.event_name == 'pull_request_target' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh pr checkout ${{ github.event.pull_request.number }} | |
- name: Install libfaketime | |
run: sudo apt install libfaketime | |
- name: Generate schematic PDFs | |
id: generate | |
run: | | |
cd hardware | |
./update-pdfs.sh cart | |
./update-pdfs.sh microcontroller | |
./update-pdfs.sh sram-bank | |
./update-pdfs.sh ethernet | |
if git diff --exit-code *.pdf; then | |
echo "needs-update=" >> $GITHUB_OUTPUT | |
echo "No changes to PDFs." | |
else | |
echo "needs-update=true" >> $GITHUB_OUTPUT | |
git add *.pdf | |
git config --local user.email "[email protected]" | |
git config --local user.name "Kinetoscope Bot" | |
git commit -m "Update schematic PDFs" | |
fi | |
- name: Update Branch | |
if: steps.generate.outputs.needs-update == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push -f origin HEAD:update-schematic-pdfs | |
gh pr create -B main -H update-schematic-pdfs \ | |
--title "Update schematic PDFs" \ | |
--body "Generated by GitHub Actions" || true |