Skip to content

Commit

Permalink
give cache and reusable workflows a try
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Sep 5, 2023
1 parent 05b9bd0 commit ea92cfd
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 60 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Compile"
on:
workflow_call:
inputs:
emacs-version:
required: true
type: string

jobs:
compile:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"

- uses: "actions/cache/restore@v3"
id: emacs-cask-cache
with:
path: |
/nix
~/.emacs.d
key: "emacs-${{ inputs.emacs-version }}-cask-${{ hashFiles('Cask') }}"

- run: |
make compile
59 changes: 59 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Set up"
on:
push:
paths-ignore:
- "README.rst"
branches:
- "main"
pull_request:
branches:
- "*"

jobs:
set_up:
runs-on: "ubuntu-latest"
continue-on-error: "${{ matrix.experimental }}"
strategy:
fail-fast: false
matrix:
emacs-version:
- "26.1"
- "26.2"
- "26.3"
- "27.1"
- "27.2"
- "28.1"
- "28.2"
- "29.1"
experimental: [false]
include:
- emacs-version: "snapshot"
experimental: true

steps:
- uses: "actions/checkout@v4"

- uses: "actions/cache@v3"
id: "emacs-cask-cache"
with:
path: |
/nix
~/.emacs.d
key: "emacs-${{ matrix.emacs-version }}-cask-${{ hashFiles('Cask') }}"

- if: ${{ steps.emacs-cask-cache.outputs.cache-hit != 'true' }
uses: "purcell/setup-emacs@master"
with:
version: "${{ matrix.emacs-version }}"

- if: ${{ steps.emacs-cask-cache.outputs.cache-hit != 'true' }
uses: "cask/setup-cask@master"
with:
version: "0.9.0"

- uses: "./compile.yml"
with:
emacs-version: "${{ matrix.emacs-version }}"
- uses: "./test.yml"
with:
emacs-version: "${{ matrix.emacs-version }}"
76 changes: 16 additions & 60 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,31 @@
name: "Test"
on:
push:
paths-ignore:
- "README.rst"
branches:
- "main"
pull_request:
branches:
- "*"
jobs:
compile:
runs-on: "ubuntu-latest"
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
emacs-version:
- "26.1"
- "26.2"
- "26.3"
- "27.1"
- "27.2"
- "28.1"
- "28.2"
- "29.1"
experimental: [false]
include:
- emacs-version: snapshot
experimental: true
steps:
- uses: "actions/checkout@v3"
- uses: "purcell/setup-emacs@master"
with:
version: ${{ matrix.emacs-version }}
- uses: "cask/setup-cask@master"
with:
version: "0.9.0"
- run: |
make compile
workflow_call:
inputs:
emacs-version:
required: true
type: string

jobs:
test:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
emacs-version:
- "26.1"
- "26.2"
- "26.3"
- "27.1"
- "27.2"
- "28.1"
- "28.2"
- "29.1"
experimental: [false]
include:
- emacs-version: snapshot
experimental: true
steps:
- uses: "actions/checkout@v3"
- uses: "purcell/setup-emacs@master"
with:
version: ${{ matrix.emacs-version }}
- uses: "cask/setup-cask@master"

- uses: "actions/cache/restore@v3"
id: emacs-cask-cache
with:
version: "0.9.0"
path: |
/nix
~/.emacs.d
key: "emacs-${{ inputs.emacs-version }}-cask-${{ hashFiles('Cask') }}"

- uses: "actions/setup-go@v4"
with:
go-version: "stable"
check-latest: true
cache: false

- name: "Install packages"
run: |
go install github.com/pelletier/go-toml/v2/cmd/tomljson@latest
Expand Down

0 comments on commit ea92cfd

Please sign in to comment.