Skip to content

Commit

Permalink
Merge pull request #13 from ok-nick/new-ci
Browse files Browse the repository at this point in the history
hash only `aftman.toml` + cache `~/.aftman/tool-storage` + renovate CI
  • Loading branch information
ok-nick committed Sep 18, 2023
2 parents d3693e5 + 089fbaa commit 3204757
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 73 deletions.
46 changes: 26 additions & 20 deletions .github/actions/test/action.yml → .github/workflows/env.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
name: Test
description: Test `setup-aftman`.
author: ok-nick
on:
workflow_call:
inputs:
version:
type: string
required: false
path:
type: string
default: "."
required: false
cache:
type: string
default: "true"
required: false

# 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

Expand All @@ -31,7 +37,7 @@ runs:
with:
version: ${{ inputs.version }}
path: ${{ inputs.path }}
token: ${{ inputs.token }}
cache: ${{ inputs.cache }}

- name: Verify executables in PATH on bash
run: |
Expand Down
56 changes: 6 additions & 50 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/workflows/env.yml
test-no-cache:
uses: ./.github/workflows/env.yml
with:
cache: "false"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down
7 changes: 5 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ runs:
if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3
with:
path: ~/.aftman/bin
key: ${{ runner.os }}-aftman-${{hashFiles(inputs.path)}}
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
run: |
Expand Down

0 comments on commit 3204757

Please sign in to comment.