From 77154a9afb75475a62086ce3bc429c14d340840c Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 10:51:23 -0400 Subject: [PATCH 01/10] refactor: remove deprecated trust options --- action.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index fa7e901..25bb108 100644 --- a/action.yml +++ b/action.yml @@ -4,23 +4,14 @@ 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 token: - description: "Github token from `github.token`" + description: "Github token via `github.token`" default: "${{ github.token }}" required: false From 5a26db60b2780950e500ffdb2b4b304957c44adb Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 11:25:22 -0400 Subject: [PATCH 02/10] feat: binary caching --- README.md | 5 +++-- action.yml | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 84c7fed..78d171c 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 directory containing `aftman.toml` (uses current directory by default) + cache: true # whether or not to enable binary caching between runs (true by default) token: ${{ github.token }} # GitHub token to bypass rate limit (passed by default) ``` diff --git a/action.yml b/action.yml index 25bb108..a1ed8ee 100644 --- a/action.yml +++ b/action.yml @@ -4,12 +4,16 @@ author: ok-nick inputs: version: - description: "`aftman` Git tag (usually in the form vx.x.x)" + 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 or not to enable caching" + default: "true" + required: false token: description: "Github token via `github.token`" default: "${{ github.token }}" @@ -27,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: | @@ -49,21 +53,29 @@ runs: - name: Set environment variable if: runner.os == 'Windows' - run: echo "$HOME/.aftman/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + run: echo "~/.aftman/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append shell: powershell - 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 + shell: bash + - name: Install tools run: | cd ${{ inputs.path }} From 8b8ed57afd43d92b4273901b6b2a77f8643557bb Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 11:30:59 -0400 Subject: [PATCH 03/10] fix: remove `shell` from cache step --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index a1ed8ee..71d9280 100644 --- a/action.yml +++ b/action.yml @@ -74,7 +74,6 @@ runs: with: path: ~/.aftman/bin key: ${{ runner.os }}-aftman - shell: bash - name: Install tools run: | From fcd6610c4a5774595ab5af7c51dac0d034fd4e30 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 11:35:25 -0400 Subject: [PATCH 04/10] ci: run PowerShell test on all platforms --- .github/actions/test/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 45e6a36..9828309 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -40,8 +40,7 @@ runs: fi shell: bash - - name: Verify executables in PATH on PowerShell for Windows - if: runner.os == 'Windows' + - name: Verify executables in PATH on PowerShell run: | Get-Command "selene" Get-Command "stylua" From d704935d05772f20a85ccfabe82664ecd5a3a26a Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 12:02:53 -0400 Subject: [PATCH 05/10] ci: use pwsh for tests on all platforms --- .github/actions/test/action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 9828309..7469627 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -33,16 +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 + - name: Verify executables in PATH on pwsh run: | Get-Command "selene" Get-Command "stylua" Get-Command "rojo" - shell: powershell + shell: pwsh From 27435a1182bbce9d94a1dbe977fe2454287d0928 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 12:05:14 -0400 Subject: [PATCH 06/10] fix: update cache on `aftman.toml` change --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 71d9280..b99142b 100644 --- a/action.yml +++ b/action.yml @@ -73,7 +73,7 @@ runs: uses: actions/cache@v3 with: path: ~/.aftman/bin - key: ${{ runner.os }}-aftman + key: ${{ runner.os }}-aftman-${{hashFiles(inputs.path)}} - name: Install tools run: | From de1b18ec799839a11fd97a567e70d27beb70cfb3 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 12:09:38 -0400 Subject: [PATCH 07/10] fix: use $HOME to set path on Windows PowerShell --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b99142b..d9462a3 100644 --- a/action.yml +++ b/action.yml @@ -53,7 +53,7 @@ runs: - name: Set environment variable if: runner.os == 'Windows' - run: echo "~/.aftman/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + run: echo "$HOME/.aftman/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append shell: powershell - name: Set environment variable From 0af90836176f7c6798eed817d641758791239b0a Mon Sep 17 00:00:00 2001 From: ok-nick Date: Thu, 3 Aug 2023 19:59:32 -0400 Subject: [PATCH 08/10] docs: typos and clarity --- README.md | 4 ++-- action.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 78d171c..3f03e58 100644 --- a/README.md +++ b/README.md @@ -23,8 +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_dir/my_project # path to project directory containing `aftman.toml` (uses current directory by default) - cache: true # whether or not to enable binary caching between runs (true by default) + 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) ``` diff --git a/action.yml b/action.yml index d9462a3..d85d7d7 100644 --- a/action.yml +++ b/action.yml @@ -11,11 +11,11 @@ inputs: default: "." required: false cache: - description: "Whether or not to enable caching" + description: "Whether to enable caching" default: "true" required: false token: - description: "Github token via `github.token`" + description: "GitHub token via `github.token`" default: "${{ github.token }}" required: false From 77a57fee667c47b581825a297d23a43aa31c4101 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Sun, 17 Sep 2023 22:50:54 -0400 Subject: [PATCH 09/10] rename CI to test --- .github/workflows/{CI.yml => test.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{CI.yml => test.yml} (99%) diff --git a/.github/workflows/CI.yml b/.github/workflows/test.yml similarity index 99% rename from .github/workflows/CI.yml rename to .github/workflows/test.yml index 50d3625..6b2dc74 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: CI +name: test on: workflow_dispatch: push: From b357749e0680f5f5d55e8cb220786b58395ccfeb Mon Sep 17 00:00:00 2001 From: ok-nick Date: Sun, 17 Sep 2023 22:51:30 -0400 Subject: [PATCH 10/10] add `cache` parameter --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef73443..4cf7c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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