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

V2 #8

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

V2 #8

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
23 changes: 15 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{
"env": { "node": true },
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint"],
"env": {
"node": true,
"es2021": true
},
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"extends": ["eslint:recommended"],
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "single"],
"indent": ["error", 2],
"comma-dangle": ["error", "always-multiline"]
},
"root": true
}
14 changes: 7 additions & 7 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ description: "Setup Node, PNPM, and install dependencies"
runs:
using: "composite"
steps:
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 7
version: 8
run_install: false

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-

- run: pnpm install --prefer-offline
- run: pnpm install --prefer-offline --frozen-lockfile
shell: bash
74 changes: 69 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
lint-build-verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -22,14 +22,78 @@ jobs:
- name: Check working copy
run: git diff --exit-code

test-starts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run TurboRepo Remote Cache Server
uses: ./
with:
storage-provider: local
storage-path: test
storage-path: turbo-cache

test-realistic:
runs-on: ubuntu-latest
env:
TURBO_TELEMETRY_DISABLED: 1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run TurboRepo Remote Cache Server
uses: ./
with:
storage-provider: local
storage-path: turbo-cache

- name: Ensure environmental variables have been set correctly
run: |
echo $TURBO_API | grep -P "^http://127.0.0.1:\d+$"
echo $TURBO_API | grep -P "^http://0.0.0.0:\d+$"
echo $TURBO_TOKEN | grep -P "^[a-zA-Z0-9]{48}$"
echo $TURBO_TEAM | grep -P "^ci$"
echo $TURBO_TEAM | grep -P "^ci$"

- name: Run turbo:test with turbo and expect no cache
run: |
# Expect no cache entries
[ ! -d "/tmp/turbo-cache/ci" ] || exit 1

pnpm turbo turbo:test > /tmp/turbo-output

# Expect a single cache entry
[ $(find /tmp/turbo-cache/ci -type f | wc -l) -eq 1 ] || exit 1

- name: Rerun turbo:test with turbo and expect cache to be used
run: |
pnpm turbo turbo:test > /tmp/turbo-output
grep "Remote caching enabled" /tmp/turbo-output > /dev/null
grep "1 cached, 1 total" /tmp/turbo-output > /dev/null
grep "FULL TURBO" /tmp/turbo-output > /dev/null

# Expect there to still just be one cache entry stored
[ $(find /tmp/turbo-cache/ci -type f | wc -l) -eq 1 ] || exit 1

test-invalid-config:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run TurboRepo Remote Cache Server with invalid storage provider
uses: ./
id: run-turbo
continue-on-error: true
with:
storage-provider: asdf
storage-path: asdf

- name: Error if prior step succeeded
if: steps.run-turbo.outcome == 'success'
run: exit 1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
log
log
.turbo
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to this project will be documented in this file.

## V2

### BREAKING
- Changed the `host` input from including `http://` to not including it. Default value changed from `http://127.0.0.1` to `0.0.0.0`.

### Changed
- Updated dependencies including turborepo-remote-cache (1.13.0 -> 2.0.8)
- Migrated from Typescript to Javascript (it just wasn't worth it)
- Updated action to run on node 20

### Fixed
- Updated `action.yml` to indicate that `storage-provider` and `storage-path` are required inputs. They were always required by the code.

## V1

### Added
- Initial release
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A GitHub action which runs a [ducktors/turborepo-remote-cache](https://github.co

### `storage-path`

**Required** The name of the bucket to use. Supports all options from [environmental variables](https://ducktors.github.io/turborepo-remote-cache/environment-variables.html) for more information.
The name of the bucket/directory to use. Supports all options from [environmental variables](https://ducktors.github.io/turborepo-remote-cache/environment-variables.html) for more information.

### `team-id`

Expand Down Expand Up @@ -38,7 +38,7 @@ You may also need to set environment variables to provide credentials to the sto

```yaml
- name: TurboRepo Remote Cache Server
uses: trappar/turborepo-remote-cache-gh-action@main
uses: trappar/turborepo-remote-cache-gh-action@v2
with:
storage-provider: s3
storage-path: my-bucket-name
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ branding:
inputs:
storage-provider:
description: "Possible values are s3, google-cloud-storage, or azure-blob-storage. Local storage is technically supported but is useless."
required: false
required: true
storage-path:
description: "The name of s3, google-cloud-storage, or azure-blob-storage bucket."
required: false
required: true
team-id:
description: "Sets the TURBO_TEAM env variable, which controls the directory where cache entries will be saved."
required: false
default: "ci"
host:
description: "Used to set the TURBO_API env variable."
required: false
default: "http://127.0.0.1"
default: "0.0.0.0"
port:
description: "Sets the port the server will listen on, and is added to the end of the TURBO_API env variable."
required: false
runs:
using: "node16"
using: "node20"
main: "dist/start/index.js"
post: "dist/post/index.js"
Loading
Loading