Merge pull request #13 from ok-nick/new-ci

hash only `aftman.toml` + cache `~/.aftman/tool-storage` + renovate CI
This commit is contained in:
nick 2023-09-18 00:55:41 -04:00 committed by GitHub
commit 320475777d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 73 deletions

View file

@ -1,28 +1,34 @@
name: Test on:
description: Test `setup-aftman`. workflow_call:
author: ok-nick
# same input as `setup-aftman`
inputs: inputs:
version: version:
type: string
required: false required: false
path: path:
type: string
default: "." default: "."
required: false required: false
token: cache:
default: "${{ github.token }}" type: string
default: "true"
required: false required: false
runs: jobs:
using: "composite" test-env:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4
- name: Create manifest file - name: Create manifest file
run: | run: |
cat > ${{ inputs.path }}/aftman.toml << EOF cat > ${{ inputs.path }}/aftman.toml << EOF
[tools] [tools]
selene = "Kampfkarren/selene@0.19.1" selene = "Kampfkarren/selene@0.25.0"
stylua = "JohnnyMorganz/stylua@0.14.0" stylua = "JohnnyMorganz/stylua@0.18.2"
rojo = "rojo-rbx/rojo@7.2.1" rojo = "rojo-rbx/rojo@7.3.0"
EOF EOF
shell: bash shell: bash
@ -31,7 +37,7 @@ runs:
with: with:
version: ${{ inputs.version }} version: ${{ inputs.version }}
path: ${{ inputs.path }} path: ${{ inputs.path }}
token: ${{ inputs.token }} cache: ${{ inputs.cache }}
- name: Verify executables in PATH on bash - name: Verify executables in PATH on bash
run: | run: |

View file

@ -13,53 +13,9 @@ defaults:
shell: bash shell: bash
jobs: jobs:
test_linux: test-cache:
runs-on: ubuntu-latest uses: ./.github/workflows/env.yml
steps: test-no-cache:
- uses: actions/checkout@v3 uses: ./.github/workflows/env.yml
- 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: with:
version: v0.2.7 cache: "false"
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"

View file

@ -24,7 +24,7 @@ steps:
with: with:
version: v1.0.0 # name of git tag in aftman (uses latest by default) 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) 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) token: ${{ github.token }} # GitHub token to bypass rate limit (passed by default)
``` ```

View file

@ -72,8 +72,11 @@ runs:
if: ${{ inputs.cache == 'true' }} if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.aftman/bin path: |
key: ${{ runner.os }}-aftman-${{hashFiles(inputs.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 - name: Install tools
run: | run: |