Skip to content

Commit

Permalink
try passing input from one job to another
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Sep 5, 2023
1 parent 0b29e2b commit 0f2ed1e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ on:
inputs:
emacs-version:
required: true
type: string
type: "string"
cache-key:
required: true
type: "string"
cache-path:
required: true
type: "string"

jobs:
compile:
Expand All @@ -13,12 +19,11 @@ jobs:
- uses: "actions/checkout@v3"

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

- run: |
make compile
10 changes: 10 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:

jobs:
set_up:
outputs:
cache-path: "${{ steps.emacs-cask-cache.outputs.cache-path }}"
cache-key: "${{ steps.emacs-cask-cache.outputs.cache-key }}"
runs-on: "ubuntu-latest"
continue-on-error: "${{ matrix.experimental }}"
strategy:
Expand Down Expand Up @@ -42,6 +45,9 @@ jobs:
~/.cask
~/.emacs.d
key: "emacs-${{ matrix.emacs-version }}-cask-${{ hashFiles('Cask') }}"
run: |
echo "cache-path=$INPUT_PATH" >> "$GITHUB_OUTPUT"
echo "cache-key=$INPUT_KEY" >> "$GITHUB_OUTPUT"
- if: ${{ steps.emacs-cask-cache.outputs.cache-hit != 'true' }}
uses: "purcell/setup-emacs@master"
Expand All @@ -58,9 +64,13 @@ jobs:
uses: "./.github/workflows/compile.yml"
with:
emacs-version: "${{ matrix.emacs-version }}"
cache-key: "${{ jobs.set_up.outputs.cache.key }}"
cache-path: "${{ jobs.set_up.outputs.cache.path }}"

test:
needs: "set_up"
uses: "./.github/workflows/test.yml"
with:
emacs-version: "${{ matrix.emacs-version }}"
cache-key: "${{ jobs.set_up.outputs.cache.key }}"
cache-path: "${{ jobs.set_up.outputs.cache.path }}"
24 changes: 14 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,35 @@ on:
inputs:
emacs-version:
required: true
type: string
type: "string"
cache-key:
required: true
type: "string"
cache-path:
required: true
type: "string"

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

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

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

- name: "Install packages"
- id: "install-tomljson"
run: |
go install github.com/pelletier/go-toml/v2/cmd/tomljson@latest
- name: "Run tests"
run: |
- run: |
make test

0 comments on commit 0f2ed1e

Please sign in to comment.