mirror of
https://github.com/expo/expo-github-action.git
synced 2026-11-15 17:32:45 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce3c32e185 | ||
|
|
050b7019f7 | ||
|
|
404bd09c6f | ||
|
|
d3602b92b2 | ||
|
|
6ac67f03d0 | ||
|
|
b8a49f4d14 |
No files matched your search
@@ -1,51 +0,0 @@
|
||||
---
|
||||
version: 2
|
||||
|
||||
scripts: &scripts
|
||||
steps:
|
||||
- checkout
|
||||
- run: yarn
|
||||
- run: yarn test
|
||||
- run: yarn lint
|
||||
- run: yarn build
|
||||
|
||||
uptodate: &uptodate
|
||||
steps:
|
||||
- checkout
|
||||
- run: yarn
|
||||
- run: yarn build
|
||||
- run: git diff --exit-code build
|
||||
|
||||
jobs:
|
||||
node-10:
|
||||
<<: *scripts
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
node-12:
|
||||
<<: *scripts
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
node-13:
|
||||
<<: *scripts
|
||||
docker:
|
||||
- image: circleci/node:13
|
||||
node-14:
|
||||
<<: *scripts
|
||||
docker:
|
||||
- image: circleci/node:14
|
||||
uptodate:
|
||||
<<: *uptodate
|
||||
requires:
|
||||
- node-12
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- node-10
|
||||
- node-12
|
||||
- node-13
|
||||
- node-14
|
||||
- uptodate
|
||||
+11
-10
@@ -1,15 +1,15 @@
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
'jest',
|
||||
],
|
||||
env: {
|
||||
es6: true,
|
||||
'jest/globals': true,
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
],
|
||||
env: {
|
||||
es6: true,
|
||||
'jest/globals': true,
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
@@ -18,6 +18,7 @@ module.exports = {
|
||||
'@typescript-eslint/explicit-member-accessibility': [
|
||||
'error', { 'accessibility': 'no-public' },
|
||||
],
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/indent': ['error', 'tab'],
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
jobs:
|
||||
build:
|
||||
name: Test and build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
node: [12, 14]
|
||||
os:
|
||||
- macos-latest
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
include:
|
||||
- node: 12
|
||||
os: macos-latest
|
||||
checkUpToDate: true
|
||||
- node: 12
|
||||
os: ubuntu-latest
|
||||
checkUpToDate: true
|
||||
steps:
|
||||
- name: Setup repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Find cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
- name: Lint package
|
||||
run: yarn lint
|
||||
- name: Test package
|
||||
run: yarn test
|
||||
- name: Build clean
|
||||
run: yarn clean
|
||||
- name: Build package
|
||||
run: yarn build
|
||||
- name: Build up-to-date
|
||||
if: ${{ matrix.checkUpToDate }}
|
||||
run: git diff --stat --exit-code build
|
||||
+21
-1
@@ -1,4 +1,24 @@
|
||||
## [5.1.0](https://github.com/expo/expo-github-action/compare/5.1.0...5.1.1) (2020-06-10)
|
||||
## [5.2.0](https://github.com/expo/expo-github-action/compare/5.1.1...5.2.0) (2020-07-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* proper space between icon and text ([#50](https://github.com/expo/expo-github-action/pull/50)) ([b8a49f4](https://github.com/expo/expo-github-action/commit/b8a49f4))
|
||||
|
||||
### Code refactors
|
||||
|
||||
* use github actions instead of circle ([#54](https://github.com/expo/expo-github-action/pull/54)) ([d3602b9](https://github.com/expo/expo-github-action/commit/d3602b9))
|
||||
|
||||
### Documentation changes
|
||||
|
||||
* fix grammar and link in readme ([#53](https://github.com/expo/expo-github-action/pull/53)) ([6ac67f0](https://github.com/expo/expo-github-action/commit/6ac67f0))
|
||||
* update build badge in readme ([#56](https://github.com/expo/expo-github-action/pull/56)) ([050b701](https://github.com/expo/expo-github-action/commit/050b701))
|
||||
|
||||
### Other chores
|
||||
|
||||
* upgrade all dependencies to latest version ([#55](https://github.com/expo/expo-github-action/pull/55)) ([404bd09](https://github.com/expo/expo-github-action/commit/404bd09))
|
||||
|
||||
|
||||
## [5.1.1](https://github.com/expo/expo-github-action/compare/5.1.0...5.1.1) (2020-06-10)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<a href="https://github.com/expo/expo-github-action/releases">
|
||||
<img src="https://img.shields.io/github/release/expo/expo-github-action/all.svg?style=flat-square" alt="releases" />
|
||||
</a>
|
||||
<a href="https://app.circleci.com/pipelines/github/expo/expo-github-action">
|
||||
<img src="https://img.shields.io/circleci/build/github/expo/expo-github-action/master?style=flat-square" alt="builds" />
|
||||
<a href="https://github.com/expo/expo-github-action/actions">
|
||||
<img src="https://img.shields.io/github/workflow/status/expo/expo-github-action/CI/master.svg?style=flat-square" alt="builds" />
|
||||
</a>
|
||||
<a href="https://github.com/expo/expo-github-action/blob/master/LICENSE.md">
|
||||
<img src="https://img.shields.io/github/license/expo/expo-github-action?style=flat-square" alt="license" />
|
||||
@@ -43,7 +43,7 @@ variable | default | description
|
||||
`expo-password` | - | The password of your Expo account _(e.g. [`${{ secrets.EXPO_CLI_PASSWORD }}`][link-actions-secrets])_
|
||||
`expo-version` | `latest` | The Expo CLI version to use, can be any [SemVer][link-semver-playground]. _(e.g. `3.x`)_
|
||||
`expo-packager` | `yarn` | The package manager to install the CLI with. _(e.g. `npm`)_
|
||||
`expo-cache` | `false` | If it should the [GitHub actions (remote) cache]((#using-the-built-in-cache)).
|
||||
`expo-cache` | `false` | If it should use the [GitHub actions (remote) cache](#using-the-built-in-cache).
|
||||
`expo-cache-key` | - | An optional custom (remote) cache key. _(**use with caution**)_
|
||||
`expo-patch-watchers` | `true` | If it should [patch the `fs.inotify.` limits](#enospc-errors-on-linux).
|
||||
|
||||
@@ -244,7 +244,7 @@ You can disable this patch by setting the `expo-patch-watchers` to `false`.
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
with :heart: <strong>byCedric</strong>
|
||||
with :heart: <strong>byCedric</strong>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
|
||||
+3180
-1252
File diff suppressed because it is too large.
Load diff
+16
-14
@@ -17,33 +17,35 @@
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"lint": "tsc --noEmit && eslint --ext ts ./src ./tests",
|
||||
"build": "ncc build src/index.ts --out build"
|
||||
"build": "ncc build src/index.ts --out build",
|
||||
"clean": "rimraf build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": "github:cypress-io/github-actions-cache#8bec6cc",
|
||||
"@actions/core": "^1.2.4",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/io": "^1.0.2",
|
||||
"@actions/tool-cache": "^1.3.4",
|
||||
"@actions/tool-cache": "^1.5.5",
|
||||
"libnpm": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/node": "^13.13.5",
|
||||
"@typescript-eslint/eslint-plugin": "^2.31.0",
|
||||
"@typescript-eslint/parser": "^2.31.0",
|
||||
"@zeit/ncc": "^0.22.1",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-jest": "^23.9.0",
|
||||
"husky": "^3.1.0",
|
||||
"@types/jest": "^26.0.4",
|
||||
"@types/node": "^12.12.49",
|
||||
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
||||
"@typescript-eslint/parser": "^3.6.1",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-plugin-jest": "^23.18.0",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.0.1",
|
||||
"jest-circus": "^26.0.1",
|
||||
"ts-jest": "^25.5.0",
|
||||
"typescript": "^3.8.3"
|
||||
"jest-circus": "^26.1.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-jest": "^26.1.2",
|
||||
"typescript": "^3.9.6"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "npm run build && git add build"
|
||||
"pre-commit": "yarn build && git add build"
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-13
@@ -1,12 +1,13 @@
|
||||
import os from 'os';
|
||||
import { join } from 'path';
|
||||
import * as remoteCache from '@actions/cache/lib';
|
||||
import * as toolCache from '@actions/tool-cache';
|
||||
import os from 'os';
|
||||
import * as cache from '../src/cache';
|
||||
import * as utils from './utils';
|
||||
|
||||
describe('fromLocalCache', () => {
|
||||
it('fetches the version specific cache', async () => {
|
||||
const path = '/path/to/local/cache';
|
||||
const path = join('path', 'to', 'local', 'cache');
|
||||
// todo: check why jest wants `never` instead of `string`
|
||||
const find = jest.spyOn(toolCache, 'find').mockResolvedValue(path as never);
|
||||
const result = await cache.fromLocalCache('3.20.1');
|
||||
@@ -17,8 +18,8 @@ describe('fromLocalCache', () => {
|
||||
|
||||
describe('toLocalCache', () => {
|
||||
it('stores the version specific cache', async () => {
|
||||
const path = '/path/to/local/cache';
|
||||
const root = '/path/from/source';
|
||||
const path = join('path', 'to', 'local', 'cache');
|
||||
const root = join('path', 'from', 'source');
|
||||
const cacheDir = jest.spyOn(toolCache, 'cacheDir').mockResolvedValue(path);
|
||||
const result = await cache.toLocalCache(root, '3.20.1');
|
||||
expect(result).toBe(path);
|
||||
@@ -32,7 +33,7 @@ describe('fromRemoteCache', () => {
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
utils.setEnv('RUNNER_TOOL_CACHE', '/cache/path');
|
||||
utils.setEnv('RUNNER_TOOL_CACHE', join('cache', 'path'));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
@@ -42,7 +43,7 @@ describe('fromRemoteCache', () => {
|
||||
it('restores remote cache with default key', async () => {
|
||||
expect(await cache.fromRemoteCache('3.20.1', 'yarn')).toBeUndefined();
|
||||
expect(remoteCache.restoreCache).toBeCalledWith(
|
||||
`/cache/path/expo-cli/3.20.1/${os.arch()}`,
|
||||
join('cache', 'path', 'expo-cli', '3.20.1', os.arch()),
|
||||
`expo-cli-${process.platform}-${os.arch()}-yarn-3.20.1`,
|
||||
`expo-cli-${process.platform}-${os.arch()}-yarn-3.20.1`,
|
||||
);
|
||||
@@ -51,7 +52,7 @@ describe('fromRemoteCache', () => {
|
||||
it('restores remote cache with custom key', async () => {
|
||||
expect(await cache.fromRemoteCache('3.20.0', 'yarn', 'custom-cache-key')).toBeUndefined();
|
||||
expect(remoteCache.restoreCache).toBeCalledWith(
|
||||
`/cache/path/expo-cli/3.20.0/${os.arch()}`,
|
||||
join('cache', 'path', 'expo-cli', '3.20.0', os.arch()),
|
||||
'custom-cache-key',
|
||||
'custom-cache-key',
|
||||
);
|
||||
@@ -60,7 +61,7 @@ describe('fromRemoteCache', () => {
|
||||
it('returns path when remote cache exists', async () => {
|
||||
spy.restore.mockResolvedValueOnce(true);
|
||||
await expect(cache.fromRemoteCache('3.20.1', 'npm')).resolves.toBe(
|
||||
`/cache/path/expo-cli/3.20.1/${os.arch()}`,
|
||||
join('cache', 'path', 'expo-cli', '3.20.1', os.arch()),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -77,21 +78,21 @@ describe('toRemoteCache', () => {
|
||||
};
|
||||
|
||||
it('saves remote cache with default key', async () => {
|
||||
expect(await cache.toRemoteCache('/local/path', '3.20.1', 'npm')).toBeUndefined();
|
||||
expect(await cache.toRemoteCache(join('local', 'path'), '3.20.1', 'npm')).toBeUndefined();
|
||||
expect(remoteCache.saveCache).toBeCalledWith(
|
||||
'/local/path',
|
||||
join('local', 'path'),
|
||||
`expo-cli-${process.platform}-${os.arch()}-npm-3.20.1`,
|
||||
);
|
||||
});
|
||||
|
||||
it('saves remote cache with custom key', async () => {
|
||||
expect(await cache.toRemoteCache('/local/path', '3.20.1', 'yarn', 'custom-cache-key')).toBeUndefined();
|
||||
expect(remoteCache.saveCache).toBeCalledWith('/local/path', 'custom-cache-key');
|
||||
expect(await cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn', 'custom-cache-key')).toBeUndefined();
|
||||
expect(remoteCache.saveCache).toBeCalledWith(join('local', 'path'), 'custom-cache-key');
|
||||
});
|
||||
|
||||
it('fails when remote cache throws', async () => {
|
||||
const error = new Error('Remote cache save failed');
|
||||
spy.save.mockRejectedValueOnce(error);
|
||||
await expect(cache.toRemoteCache('/local/path', '3.20.1', 'yarn')).rejects.toBe(error);
|
||||
await expect(cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn')).rejects.toBe(error);
|
||||
});
|
||||
});
|
||||
+17
-2
@@ -25,7 +25,6 @@ describe('authenticate', () => {
|
||||
utils.setEnv('TEST_INCLUDED', 'hellyeah');
|
||||
await expo.authenticate('bycedric', 'mypassword');
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo');
|
||||
expect(spy.exec.mock.calls[0][1]).toStrictEqual(['login', '--username=bycedric'])
|
||||
expect(spy.exec.mock.calls[0][2]).toMatchObject({
|
||||
env: {
|
||||
@@ -36,7 +35,23 @@ describe('authenticate', () => {
|
||||
utils.restoreEnv();
|
||||
});
|
||||
|
||||
it('executes login command with `.cmd` suffix on windows', async () => {
|
||||
it('executes login command with `expo` on macos', async () => {
|
||||
utils.setPlatform('darwin');
|
||||
await expo.authenticate('bycedric', 'mypassword');
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
|
||||
it('executes login command with `expo` on ubuntu', async () => {
|
||||
utils.setPlatform('linux');
|
||||
await expo.authenticate('bycedric', 'mypassword');
|
||||
expect(spy.exec).toBeCalled();
|
||||
expect(spy.exec.mock.calls[0][0]).toBe('expo');
|
||||
utils.restorePlatform();
|
||||
});
|
||||
|
||||
it('executes login command with `expo.cmd` on windows', async () => {
|
||||
utils.setPlatform('win32');
|
||||
await expo.authenticate('bycedric', 'mypassword');
|
||||
expect(spy.exec).toBeCalled();
|
||||
|
||||
+18
-17
@@ -13,6 +13,7 @@ jest.mock('@actions/io', () => io);
|
||||
jest.mock('libnpm', () => registry);
|
||||
jest.mock('../src/cache', () => cache);
|
||||
|
||||
import { join } from 'path';
|
||||
import * as install from '../src/install';
|
||||
import * as utils from './utils';
|
||||
|
||||
@@ -26,39 +27,39 @@ describe('resolve', () => {
|
||||
|
||||
describe('install', () => {
|
||||
it('installs path from local cache', async () => {
|
||||
cache.fromLocalCache.mockResolvedValue('/cache/path');
|
||||
cache.fromLocalCache.mockResolvedValue(join('cache', 'path'));
|
||||
const expoPath = await install.install({ version: '3.0.10', packager: 'npm' });
|
||||
expect(expoPath).toBe('/cache/path/node_modules/.bin');
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
});
|
||||
|
||||
it('installs path from packager and cache it locally', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', '/temp/path');
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
cache.fromLocalCache.mockResolvedValue(undefined);
|
||||
cache.toLocalCache.mockResolvedValue('/cache/path');
|
||||
cache.toLocalCache.mockResolvedValue(join('cache', 'path'));
|
||||
const expoPath = await install.install({ version: '3.0.10', packager: 'npm' });
|
||||
expect(expoPath).toBe('/cache/path/node_modules/.bin');
|
||||
expect(cache.toLocalCache).toBeCalledWith('/temp/path', '3.0.10');
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
expect(cache.toLocalCache).toBeCalledWith(join('temp', 'path'), '3.0.10');
|
||||
utils.restoreEnv();
|
||||
});
|
||||
|
||||
it('installs path from remote cache', async () => {
|
||||
cache.fromLocalCache.mockResolvedValue(undefined);
|
||||
cache.fromRemoteCache.mockResolvedValue('/cache/path');
|
||||
cache.fromRemoteCache.mockResolvedValue(join('cache', 'path'));
|
||||
registry.manifest.mockResolvedValue({ version: '3.20.0' });
|
||||
const expoPath = await install.install({ version: '3.20.1', packager: 'npm', cache: true });
|
||||
expect(expoPath).toBe('/cache/path/node_modules/.bin');
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
expect(cache.fromRemoteCache).toBeCalledWith('3.20.0', 'npm', undefined);
|
||||
});
|
||||
|
||||
it('installs path from packager and cache it remotely', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', '/temp/path');
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
cache.fromLocalCache.mockResolvedValue(undefined);
|
||||
cache.fromRemoteCache.mockResolvedValue(undefined);
|
||||
cache.toLocalCache.mockResolvedValue('/cache/path');
|
||||
cache.toLocalCache.mockResolvedValue(join('cache', 'path'));
|
||||
registry.manifest.mockResolvedValue({ version: '3.20.1' });
|
||||
const expoPath = await install.install({ version: '3.20.1', packager: 'npm', cache: true });
|
||||
expect(expoPath).toBe('/cache/path/node_modules/.bin');
|
||||
expect(cache.toRemoteCache).toBeCalledWith('/cache/path', '3.20.1', 'npm', undefined);
|
||||
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
|
||||
expect(cache.toRemoteCache).toBeCalledWith(join('cache', 'path'), '3.20.1', 'npm', undefined);
|
||||
utils.restoreEnv();
|
||||
});
|
||||
});
|
||||
@@ -70,21 +71,21 @@ describe('fromPackager', () => {
|
||||
});
|
||||
|
||||
it('creates temporary folder', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', '/temp/path');
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
await install.fromPackager('latest', 'yarn');
|
||||
expect(io.mkdirP).toBeCalledWith('/temp/path');
|
||||
expect(io.mkdirP).toBeCalledWith(join('temp', 'path'));
|
||||
utils.restoreEnv();
|
||||
});
|
||||
|
||||
it('installs expo with tool', async () => {
|
||||
utils.setEnv('RUNNER_TEMP', '/temp/path');
|
||||
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
|
||||
io.which.mockResolvedValue('npm');
|
||||
const expoPath = await install.fromPackager('beta', 'npm');
|
||||
expect(expoPath).toBe('/temp/path');
|
||||
expect(expoPath).toBe(join('temp', 'path'));
|
||||
expect(cli.exec).toBeCalled();
|
||||
expect(cli.exec.mock.calls[0][0]).toBe('npm');
|
||||
expect(cli.exec.mock.calls[0][1]).toStrictEqual(['add', 'expo-cli@beta']);
|
||||
expect(cli.exec.mock.calls[0][2]).toMatchObject({ cwd: '/temp/path' });
|
||||
expect(cli.exec.mock.calls[0][2]).toMatchObject({ cwd: join('temp', 'path') });
|
||||
utils.restoreEnv();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user