From 7cb084aa74c4a1bca1a7b883575c82390b73a9a2 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Sun, 17 Sep 2023 23:38:22 -0400 Subject: [PATCH 1/7] fix: hash only `aftman.toml` --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d85d7d7..32edfb6 100644 --- a/action.yml +++ b/action.yml @@ -73,7 +73,7 @@ runs: uses: actions/cache@v3 with: path: ~/.aftman/bin - key: ${{ runner.os }}-aftman-${{hashFiles(inputs.path)}} + key: ${{ runner.os }}-aftman-${{hashFiles(format('{0}/{1}', inputs.path, 'aftman.toml'))}} - name: Install tools run: | From 9b2e586476a30df794df1059bf9a4c3e5c07e6e5 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Mon, 18 Sep 2023 00:09:47 -0400 Subject: [PATCH 2/7] ci: matrix and reusable workflows + test no cache --- .../test/action.yml => workflows/env.yml} | 46 ++++++++------- .github/workflows/test.yml | 56 ++----------------- README.md | 2 +- 3 files changed, 34 insertions(+), 70 deletions(-) rename .github/{actions/test/action.yml => workflows/env.yml} (50%) diff --git a/.github/actions/test/action.yml b/.github/workflows/env.yml similarity index 50% rename from .github/actions/test/action.yml rename to .github/workflows/env.yml index 7469627..3b9c70a 100644 --- a/.github/actions/test/action.yml +++ b/.github/workflows/env.yml @@ -1,28 +1,35 @@ -name: Test -description: Test `setup-aftman`. -author: ok-nick +on: + workflow_call: + inputs: + version: + required: false + type: string + path: + required: false + type: string + cache: + required: false + type: string + token: + required: false + type: string -# same input as `setup-aftman` -inputs: - version: - required: false - path: - default: "." - required: false - token: - default: "${{ github.token }}" - required: false +jobs: + test-env: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 -runs: - using: "composite" - steps: - name: Create manifest file run: | cat > ${{ inputs.path }}/aftman.toml << EOF [tools] - selene = "Kampfkarren/selene@0.19.1" - stylua = "JohnnyMorganz/stylua@0.14.0" - rojo = "rojo-rbx/rojo@7.2.1" + selene = "Kampfkarren/selene@0.25.0" + stylua = "JohnnyMorganz/stylua@0.18.2" + rojo = "rojo-rbx/rojo@7.3.0" EOF shell: bash @@ -31,6 +38,7 @@ runs: with: version: ${{ inputs.version }} path: ${{ inputs.path }} + cache: ${{ inputs.cache }} token: ${{ inputs.token }} - name: Verify executables in PATH on bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b2dc74..3d7e9c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,53 +13,9 @@ defaults: shell: bash jobs: - test_linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/test - - test_mac: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/test - - test_windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/test - - test_linux_version_and_path: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - run: mkdir project - - uses: ./.github/actions/test - with: - version: v0.2.7 - path: "./project" - - test_mac_version_and_path: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - - run: mkdir project - - uses: ./.github/actions/test - with: - version: v0.2.7 - path: "./project" - - test_windows_version_and_path: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - - run: mkdir project - - uses: ./.github/actions/test - with: - version: v0.2.7 - path: "./project" + test-cache: + uses: ./.github/actions/env.yml + test-no-cache: + uses: ./.github/actions/env.yml + with: + cache: "false" diff --git a/README.md b/README.md index 319b332..fe7fc29 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ steps: with: version: v1.0.0 # name of git tag in aftman (uses latest 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) + cache: "true" # whether to enable binary caching between runs (true by default) token: ${{ github.token }} # GitHub token to bypass rate limit (passed by default) ``` From 51834c2f5a3fecfd47988e216bbe90ce78399d98 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Mon, 18 Sep 2023 00:17:16 -0400 Subject: [PATCH 3/7] ci: fix path to env.yml --- .github/workflows/env.yml | 8 ++++---- .github/workflows/test.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/env.yml b/.github/workflows/env.yml index 3b9c70a..52fcfbd 100644 --- a/.github/workflows/env.yml +++ b/.github/workflows/env.yml @@ -2,17 +2,17 @@ on: workflow_call: inputs: version: - required: false type: string - path: required: false + path: type: string - cache: required: false + cache: type: string - token: required: false + token: type: string + required: false jobs: test-env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d7e9c5..86d0372 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,8 +14,8 @@ defaults: jobs: test-cache: - uses: ./.github/actions/env.yml + uses: ./.github/workflows/env.yml test-no-cache: - uses: ./.github/actions/env.yml + uses: ./.github/workflows/env.yml with: cache: "false" From f81b6bf54e74639f4f5c2e6ec7c06c239df50eb7 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Mon, 18 Sep 2023 00:22:07 -0400 Subject: [PATCH 4/7] ci: add default inputs --- .github/workflows/env.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/env.yml b/.github/workflows/env.yml index 52fcfbd..e70ea9a 100644 --- a/.github/workflows/env.yml +++ b/.github/workflows/env.yml @@ -6,12 +6,15 @@ on: required: false path: type: string + default: "." required: false cache: type: string + default: "true" required: false token: type: string + default: "${{ github.token }}" required: false jobs: From 73862097624fc63d5725824aaa8bd0ff80b344ed Mon Sep 17 00:00:00 2001 From: ok-nick Date: Mon, 18 Sep 2023 00:24:39 -0400 Subject: [PATCH 5/7] ci: only default path --- .github/workflows/env.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/env.yml b/.github/workflows/env.yml index e70ea9a..34b2d60 100644 --- a/.github/workflows/env.yml +++ b/.github/workflows/env.yml @@ -10,11 +10,9 @@ on: required: false cache: type: string - default: "true" required: false token: type: string - default: "${{ github.token }}" required: false jobs: From 5185e135bf00ebea2fa411c54ae20a5d3b3c11b8 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Mon, 18 Sep 2023 00:26:00 -0400 Subject: [PATCH 6/7] ci: remove token test input --- .github/workflows/env.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/env.yml b/.github/workflows/env.yml index 34b2d60..5f103a4 100644 --- a/.github/workflows/env.yml +++ b/.github/workflows/env.yml @@ -10,9 +10,7 @@ on: required: false cache: type: string - required: false - token: - type: string + default: "true" required: false jobs: @@ -40,7 +38,6 @@ jobs: version: ${{ inputs.version }} path: ${{ inputs.path }} cache: ${{ inputs.cache }} - token: ${{ inputs.token }} - name: Verify executables in PATH on bash run: | From 089fbaada1afc7c141effccb59a0d292fa22f7e1 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Mon, 18 Sep 2023 00:49:33 -0400 Subject: [PATCH 7/7] fix: also cache tool-storage --- action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 32edfb6..68f25ed 100644 --- a/action.yml +++ b/action.yml @@ -72,7 +72,10 @@ runs: if: ${{ inputs.cache == 'true' }} uses: actions/cache@v3 with: - path: ~/.aftman/bin + path: | + ~/.aftman/bin + ~/.aftman/tool-storage + # TODO: also hash ~/.aftman/aftman.toml key: ${{ runner.os }}-aftman-${{hashFiles(format('{0}/{1}', inputs.path, 'aftman.toml'))}} - name: Install tools