Skip to content

test.yml: Add paths-ignore for push & pull_request #362

test.yml: Add paths-ignore for push & pull_request

test.yml: Add paths-ignore for push & pull_request #362

Workflow file for this run

name: CI
on:
push:
branches:
- master
paths-ignore: &doc-files
- '**.png'
- '**.svg'
- '**.md'
- '**.texi'
- '**.info'
- '.dir-locals.el'
- '.gitignore'
pull_request:
paths-ignore: *doc-files
# Caching adapted from
# https://shawnhoover.dev/notes/caching-emacs-binaries-in-github-workflows.html
# (I extended to multiple versions, hopefully still works...)
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
emacs_version:
- 24.5
- 25.3
- 26.3
- 27.2
- 28.2
- 29.4
- 30.2
- snapshot
- release-snapshot
env:
EMACS_VERSION: ${{ matrix.emacs_version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Compute snapshot cache epoch
if: contains(matrix.emacs_version, 'snapshot')
run: |
# %U is week number, so we will update cache key for snapshots
# every week.
echo "SNAPSHOT_EPOCH=$(date +%Y-%U)" >> $GITHUB_ENV
- name: Cache Emacs - get
id: cache-emacs
uses: actions/cache@v5
with:
path: /home/runner/.local/nix/store-emacs
key: ${{ runner.os }}${{ runner.arch }}-Emacs-${{ matrix.emacs_version }}${{ env.SNAPSHOT_EPOCH }}
- name: Install Emacs (no cache)
uses: purcell/setup-emacs@master
if: steps.cache-emacs.outputs.cache-hit != 'true'
with:
version: ${{ matrix.emacs_version }}
- name: Cache emacs - Miss - Put
if: steps.cache-emacs.outputs.cache-hit != 'true'
run: |
mkdir -p $HOME/.local/nix/store-emacs
nix-store --query --requisites "$(readlink -f $(which emacs))" | xargs -I {} rsync -av {} $HOME/.local/nix/store-emacs
- name: Cache emacs - Hit
if: steps.cache-emacs.outputs.cache-hit == 'true'
run: |
sudo mkdir -p /nix/store
sudo ln -s $HOME/.local/nix/store-emacs/* /nix/store/
test -x /nix/store/*-emacs-*/bin/emacs
echo /nix/store/*-emacs-*/bin >> $GITHUB_PATH
- name: Print Emacs version and environment variables
run: |
emacs --version
env
- uses: dorny/paths-filter@v4
id: src-changes
with:
filters: |
src:
- '**/*.el'
- '**/*.sh'
- '.github/workflows/*.yml'
- name: Compilation
if: steps.src-changes.outputs.src == 'true'
run: |
./test/github-actions.sh byte-compile -Werror
# Only needed once, skip for all but 1 version
- name: Simple Checks
if: matrix.emacs_version == '29.4'
run: |
if [ '${{ github.event_name }}' = "pull_request" ]; then
COMMIT_RANGE='${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}'
else
COMMIT_RANGE='${{ github.event.before }}..${{ github.sha }}'
fi ; export COMMIT_RANGE
./test/github-actions.sh check-recipes -Wno-features -Wno-github -Wno-autoloads recipes/
./test/github-actions.sh check-whitespace
./test/github-actions.sh check-filenames
- name: Test
if: steps.src-changes.outputs.src == 'true'
run: |
./test/github-actions.sh ert-tests