Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cache binaries and prepare for 0.4.0 #10

Merged
merged 10 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@ runs:
path: ${{ inputs.path }}
token: ${{ inputs.token }}

- name: Verify executables in PATH on Bash
- name: Verify executables in PATH on bash
run: |
if ! hash selene stylua rojo 2>/dev/null; then
exit 1;
fi
command -v selene
command -v stylua
command -v rojo
shell: bash

- name: Verify executables in PATH on PowerShell for Windows
if: runner.os == 'Windows'
- name: Verify executables in PATH on pwsh
run: |
Get-Command "selene"
Get-Command "stylua"
Get-Command "rojo"
shell: powershell
shell: pwsh
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: test
on:
workflow_dispatch:
push:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## Added
- Add `cache` parameter and cache by default

## [0.3.0] - 2022-09-27
## Added
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
GitHub action to install and run [aftman](https://github.com/LPGhatguy/aftman); a toolchain manager.

## Usage
This is the most common case and automatically provides all the parameters using the latest released version of `aftman`.
Use the latest released version of `aftman` with default parameters:
```yaml
steps:
- uses: ok-nick/setup-aftman@v0.3.0
Expand All @@ -23,7 +23,8 @@ steps:
- uses: ok-nick/setup-aftman@v0.3.0
with:
version: v1.0.0 # name of git tag in aftman (uses latest by default)
path: some_directory/my_project # path to project directory containing `aftman.toml`
path: some_dir/my_project # path to project dir containing `aftman.toml` (uses current dir by default)
cache: true # whether to enable binary caching between runs (true by default)
token: ${{ github.token }} # GitHub token to bypass rate limit (passed by default)
```

Expand Down
30 changes: 16 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ author: ok-nick

inputs:
version:
description: "`aftman` version in the form `vx.x.x`"
required: false
trust-check:
description: "Whether to check trusts"
deprecationMessage: "Input `trust-check` is no longer used in `setup-aftman`, consider removing it from your configuration"
default: "true"
required: false
trusts:
description: "List of trusted tools separated by spaces"
deprecationMessage: "Input `trusts` is no longer used in `setup-aftman`, consider removing it from your configuration"
description: "`aftman` git tag (usually in the form vx.x.x)"
required: false
path:
description: "Path to the `aftman.toml` directory"
default: "."
required: false
cache:
description: "Whether to enable caching"
default: "true"
required: false
token:
description: "Github token from `github.token`"
description: "GitHub token via `github.token`"
default: "${{ github.token }}"
required: false

Expand All @@ -36,9 +31,9 @@ runs:
esac

gh release download ${{ inputs.version }} --repo LPGhatguy/aftman --pattern $pattern
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash

- name: Install aftman
run: |
Expand All @@ -63,16 +58,23 @@ runs:

- name: Set environment variable
if: runner.os != 'Windows'
run: echo "$HOME/.aftman/bin" >> $GITHUB_PATH
run: echo "~/.aftman/bin" >> $GITHUB_PATH
shell: bash

- name: Create auth file
run: |
cat > $HOME/.aftman/auth.toml << EOF
cat > ~/.aftman/auth.toml << EOF
github = "${{ inputs.token }}"
EOF
shell: bash

- name: Cache binaries
if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3
with:
path: ~/.aftman/bin
key: ${{ runner.os }}-aftman-${{hashFiles(inputs.path)}}

- name: Install tools
run: |
cd ${{ inputs.path }}
Expand Down