Skip to content

Commit

Permalink
feat: add support for caching (#8)
Browse files Browse the repository at this point in the history
```yaml
  - uses: cashapp/activate-hermit@v1
    with:
      cache: true
```

This necessitated switching to a composite action, and I couldn't figure
out a way to keep the existing JS action when using it. TBH I think the
script approach is a bit cleaner anyway.

Also introduced a CI test for the action, and verified it with `act`.
  • Loading branch information
alecthomas authored Dec 21, 2023
1 parent 94aa5ac commit 7b79792
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 3,034 deletions.
7 changes: 1 addition & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,4 @@ updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
interval: weekly
32 changes: 0 additions & 32 deletions .github/workflows/build.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ./
with:
cache: true
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Test the action using act
test:
act --container-architecture linux/amd64
23 changes: 21 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ inputs:
description: 'The directory with the Hermit environment (contains `bin/hermit`)'
required: false
default: './'
cache:
description: 'If "true", installed Hermit packages will be cached.'
required: false
default: 'false'
runs:
using: 'node16'
main: 'dist/index.js'
using: composite
steps:
- if: ${{ inputs.cache == 'true' }}
uses: theowenyoung/folder-hash@v3
id: bin-hash
with:
path: ./${{ inputs.working-directory }}/bin
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3
with:
path: ${{ runner.os == 'macOS' && '~/Library/Caches/hermit/pkg' || '~/.cache/hermit/pkg' }}
key: ${{ runner.os }}-hermit-cache-${{ steps.bin-hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-hermit-cache-
- shell: bash
working-directory: ${{ inputs.working-directory }}
run: ./bin/hermit env --raw >> "$GITHUB_ENV"
File renamed without changes.
1 change: 1 addition & 0 deletions bin/.just-1.16.0.pkg
1 change: 1 addition & 0 deletions bin/act
1 change: 0 additions & 1 deletion bin/corepack

This file was deleted.

1 change: 1 addition & 0 deletions bin/just
1 change: 0 additions & 1 deletion bin/node

This file was deleted.

1 change: 0 additions & 1 deletion bin/npm

This file was deleted.

1 change: 0 additions & 1 deletion bin/npx

This file was deleted.

Loading

0 comments on commit 7b79792

Please sign in to comment.