Ignore pull requests that notifies about xxd.c updates #103
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: Build and benchmark | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/.gitignore' | |
- '**/README.md' | |
- '**/TODO.md' | |
- '**/*.txt' | |
- '**/*.sh' | |
- '**/tinyxxd*.png' | |
- '**/tinyxxd*.svg' | |
pull_request: | |
branches-ignore: | |
- 'src-*-update*' | |
paths-ignore: | |
- '**/.gitignore' | |
- '**/README.md' | |
- '**/TODO.md' | |
- '**/*.txt' | |
- '**/*.sh' | |
- '**/tinyxxd*.png' | |
- '**/tinyxxd*.svg' | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
container: archlinux:latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Update system and Install dependencies | |
run: | | |
pacman -Syu --noconfirm && \ | |
pacman -S --noconfirm --needed curl diffutils gcc make && \ | |
pacman -Scc --noconfirm | |
- name: Build | |
run: make | |
- name: Test | |
run: make test | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build | |
run: make | |
- name: Test | |
run: make test | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup environment | |
run: | | |
choco install curl diffutils make mingw -y | |
- name: Build | |
run: make CC=gcc | |
benchmark-linux: | |
needs: build-linux | |
runs-on: ubuntu-latest | |
container: archlinux:latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cache benchmark results | |
uses: actions/cache@v4 | |
with: | |
path: ./results.pkl | |
key: results-${{ github.ref }}-${{ github.run_id }} | |
restore-keys: results-${{ github.ref }}- | |
- name: Install dependencies | |
run: | | |
pacman -Syu --noconfirm && \ | |
pacman -S --noconfirm --needed curl diffutils gcc git gnuplot make python && \ | |
pacman -Scc --noconfirm | |
- name: Check for cached results | |
run: | | |
if [ -f results.pkl ]; then | |
echo "Cached results.pkl found." | |
else | |
echo "No cached results.pkl found." | |
fi | |
- name: Run bench.py | |
run: python3 bench.py -s | |
- name: Archive results for Git operations | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchmark-results | |
path: | | |
bench*.md | |
img/ | |
benchmark-commit: | |
needs: benchmark-linux | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download benchmark results | |
uses: actions/download-artifact@v4 | |
with: | |
name: benchmark-results | |
- name: Configure Git | |
run: | | |
git config user.name 'GitHub Actions' | |
git config user.email 'actions@github.com' | |
- name: Check for changes | |
id: git-check | |
run: | | |
git add bench*.md img/ | |
if git diff --staged --quiet; then | |
echo "No changes to the content." | |
echo "::set-output name=changes::false" | |
else | |
echo "Content changes detected." | |
echo "::set-output name=changes::true" | |
fi | |
- name: Commit benchmark updates | |
if: steps.git-check.outputs.changes == 'true' | |
run: | | |
git commit -m "Update benchmarks and images" -a | |
git push |