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

refactor: enable caches by default #148

Merged
merged 2 commits into from
Jan 13, 2022
Merged
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Here is a summary of all the variables that you can use and their purpose.
| variable | default | description |
| ---------------- | ------- | ------------------------------------------------------------------------------------ |
| `expo-version` | `''` | [Expo CLI](https://github.com/expo/expo-cli) version to install, skips when omitted. |
| `expo-cache` | `false` | If it should use the [GitHub actions cache](#using-the-built-in-cache). |
| `expo-cache` | `true` | If it should use the [GitHub actions cache](#using-the-built-in-cache). |
| `eas-version` | `''` | [EAS CLI](https://github.com/expo/eas-cli) version to install, skips when omitted. |
| `eas-cache` | `false` | If it should use the [GitHub actions cache](#using-the-built-in-cache). |
| `eas-cache` | `true` | If it should use the [GitHub actions cache](#using-the-built-in-cache). |
| `packager` | `yarn` | The package manager to use. _(e.g. `yarn` or `npm`)_ |
| `token` | `''` | The token of your Expo account |
| `patch-watchers` | `true` | If it should [patch the `fs.inotify.` limits](#enospc-errors-on-linux). |
Expand Down Expand Up @@ -190,9 +190,9 @@ This action can export the `EXPO_TOKEN` variable to access it in every step.

### Using the built-in cache

You can opt-in to caching the installation, making it a lot faster.
Under the hood, it uses the [`@actions/cache`][link-actions-cache-package] package to restore the Expo CLI installation.
This action generates a unique cache key for the OS, used packager, and exact version of the Expo CLI.
Caching is enabled by default to speed up consecutive CLI installs, but you can still opt-out to this.
Under the hood, it uses the [`@actions/cache`][link-actions-cache-package] package to restore the CLI installation.
This action generates a unique cache key for the OS, used packager, and exact version of the CLI.

> Note, this cache will count towards your [repo cache limit][link-actions-cache-limit]. The Expo and EAS CLI are stored in different caches.

Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ inputs:
description: Expo CLI version to install
expo-cache:
description: If Expo CLI should be cached to speed up installation
default: false
default: true
eas-version:
description: EAS CLI version to install
eas-cache:
description: If EAS CLI should be cached to speed up installation
default: false
default: true
packager:
description: The package manager used to install the CLIs
default: yarn
Expand Down
4 changes: 2 additions & 2 deletions build/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65134,9 +65134,9 @@ const worker_1 = __nccwpck_require__(8912);
(0, worker_1.executeAction)(setupAction);
function setupInput() {
return {
easCache: (0, core_1.getBooleanInput)('eas-cache'),
easCache: !(0, core_1.getInput)('eas-cache') || (0, core_1.getBooleanInput)('eas-cache'),
easVersion: (0, core_1.getInput)('eas-version'),
expoCache: (0, core_1.getBooleanInput)('expo-cache'),
expoCache: !(0, core_1.getInput)('expo-cache') || (0, core_1.getBooleanInput)('expo-cache'),
expoVersion: (0, core_1.getInput)('expo-version'),
packager: (0, core_1.getInput)('packager') || 'yarn',
patchWatchers: !(0, core_1.getInput)('patch-watchers') || (0, core_1.getBooleanInput)('patch-watchers'),
Expand Down
4 changes: 2 additions & 2 deletions src/actions/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export type SetupInput = ReturnType<typeof setupInput>;

export function setupInput() {
return {
easCache: getBooleanInput('eas-cache'),
easCache: !getInput('eas-cache') || getBooleanInput('eas-cache'),
easVersion: getInput('eas-version'),
expoCache: getBooleanInput('expo-cache'),
expoCache: !getInput('expo-cache') || getBooleanInput('expo-cache'),
expoVersion: getInput('expo-version'),
packager: getInput('packager') || 'yarn',
patchWatchers: !getInput('patch-watchers') || getBooleanInput('patch-watchers'),
Expand Down
6 changes: 3 additions & 3 deletions tests/actions/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jest.mock('../../src/worker');
describe(setupInput, () => {
it('returns object with correct defaults', () => {
expect(setupInput()).toMatchObject({
easCache: undefined,
easCache: true,
easVersion: undefined,
expoCache: undefined,
expoCache: true,
expoVersion: undefined,
packager: 'yarn',
patchWatchers: true,
Expand Down Expand Up @@ -72,7 +72,7 @@ describe(setupAction, () => {

it(`installs ${cliName} using npm`, async () => {
jest.mocked(packager.resolvePackage).mockResolvedValue('5.0.3');
await setupAction({ ...input, [cliVersion]: '5.x', packager: 'npm' });
await setupAction({ ...input, [cliVersion]: '5.x', [cliCache]: false, packager: 'npm' });
expect(packager.installPackage).toBeCalledWith(cliName, '5.0.3', 'npm');
expect(worker.installToolFromPackage).toBeCalled();
});
Expand Down