Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
trappar committed Feb 18, 2023
1 parent b9b4560 commit 1ce55cf
Show file tree
Hide file tree
Showing 25 changed files with 254,181 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
11 changes: 11 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"env": { "node": true },
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"plugins": ["@typescript-eslint"],
"root": true
}
26 changes: 26 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Setup"
description: "Setup Node, PNPM, and install dependencies"
runs:
using: "composite"
steps:
- uses: pnpm/action-setup@v2
with:
version: 7
run_install: false

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

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

- uses: actions/cache@v3
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
shell: bash
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Run Lint
run: pnpm lint

- name: Build
run: pnpm build

- name: Check working copy
run: git diff --exit-code

- name: Run TurboRepo Remote Cache Server
uses: ./
with:
port: 42042
storage-provider: local
storage-path: test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
log
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# TurboRepo Remote Cache GitHub Action

A GitHub action which runs a [ducktors/turborepo-remote-cache](https://github.com/ducktors/turborepo-remote-cache) server in the background so you can use any of the non-local [supported storage providers](https://ducktors.github.io/turborepo-remote-cache/supported-storage-providers.html) to cache your TurboRepo builds.

## Inputs

### `storage-provider`

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

### `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.

### `team-id`

The Team ID to use. This controls the directory where cache entries will be saved. Default `"ci"`.

### `port`

The port to run the server on. This is configurable in case of a port collision, but shouldn't normally need to be changed. Default `"42042"`.

## Environment variables

You may also need to set environment variables to provide credentials to the storage provider. See [supported storage providers](https://ducktors.github.io/turborepo-remote-cache/supported-storage-providers.html) for more information.

## Example usage

```yaml
- uses: trappar/turborepo-remote-cache-gh-action@v1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
with:
storage-provider: s3
storage-path: my-bucket-name
```
No further configuration is required. The action will automatically set environmental variables which TurboRepo uses to connect to the remote cache server.
22 changes: 22 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "TurboRepo Remote Cache Server"
description: "Runs a TurboRepo remote cache server based on ducktors/turborepo-remote-cache."
author: trappar
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
storage-path:
description: "The name of s3, google-cloud-storage, or azure-blob-storage bucket."
required: false
team-id:
description: "Sets the TURBO_TEAM env variable, which controls the directory where cache entries will be saved."
required: false
default: "ci"
port:
description: "Port to listen on."
required: false
default: "42042"
runs:
using: "node16"
main: "dist/start/index.js"
post: "dist/post/index.js"
Loading

0 comments on commit 1ce55cf

Please # to comment.