Compare commits

...
57 Commits
Author SHA1 Message Date
Cedric van Putten 1cf961c401 chore: release new version with cache 2019-12-31 00:53:41 +00:00
Cedric van Putten 69801f0afc feat: implement caching using github actions cache (#35)
* feat: implement remote cache based on github actions cache

This allows us to use an internal remote cache, which is not "supported" by GitHub though.

* docs: update documentation about the built-in cache
2019-12-31 01:15:12 +01:00
Cedric van Putten 3ac4a96cb4 docs: update the default packager value in action (#34) 2019-12-30 19:32:56 +01:00
Cedric van Putten f80ef1f629 refactor: move index code to run (#33)
* refactor: move index code to run

This makes the code a bit more predicatable, it only self-executes when importing index

* chore: unify test code with it prefix
2019-12-30 19:28:55 +01:00
Cedric van Putten 2de5b8c3bd refactor!: use yarn by default instead of npm (#32)
Expo recommends using yarn, so lets use that by default.
2019-12-30 16:46:32 +01:00
Cedric van Putten 48288d587a refactor: use ncc to compile scripts (#31)
* refactor: use ncc to compile scripts into smaller files

* refactor: remove node modules from repo

These are now compiled into smaller files with ncc. No need to keep it in the repository.
2019-12-30 16:40:14 +01:00
Cedric van Putten 12f58a21ef refactor: make logs more visible (#30)
This should make the action steps a bit more transparent and could help developers debugging.
2019-12-30 15:47:47 +01:00
Cedric van Putten 7776e33fb4 refactor: update all dependencies to latest versions (#29) 2019-12-30 15:19:35 +01:00
dependabot[bot] 4aa2c230ec chore(deps): bump handlebars from 4.2.0 to 4.5.3 (#27)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.2.0 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.2.0...v4.5.3)

Signed-off-by: dependabot[bot] <[email protected]>
2019-12-30 15:09:31 +01:00
Cedric van Putten e5677e1fa3 refactor: use circleci instead of github actions (#28)
Unforuntately, GitHub decided that the Expo organisation doesnt have access to GitHub actions anymore (even for open source repositories).
2019-12-30 15:07:44 +01:00
Cedric van Putten 68a2de09aa docs: remove beta warning just before general availability 2019-10-30 23:34:45 +01:00
Cedric van Putten 831bcb12d3 fix: use cmd suffix when authenticating on windows 2019-10-30 23:19:48 +01:00
Cedric van Putten 8ff07e0da8 chore: enable workflow for pull requests 2019-10-30 23:12:46 +01:00
Cedric van Putten 16d4b1519f chore: update all dependencies to latest version 2019-10-30 21:05:59 +01:00
Cedric van Putten cbd9aceff6 fix: add patch for watchers limit and enospc error 2019-10-29 00:56:33 +01:00
Cedric van Putten a80a00b2cd release: new release for yml github actions 2019-09-29 14:46:00 +00:00
Cedric van Putten 38e963b075 docs: update documentation for the new action 2019-09-29 16:35:44 +02:00
Cedric van Putten 929a76ca04 feat: add github workflow for ci 2019-09-29 16:35:44 +02:00
Cedric van Putten 00692c48ca fix: add build and node node modules before commit 2019-09-29 16:35:44 +02:00
Cedric van Putten b2929e3879 fix: add build and node node modules in husky hook 2019-09-29 16:35:44 +02:00
Cedric van Putten 04cd479159 chore: add linter and fix all files 2019-09-29 16:35:44 +02:00
Cedric van Putten cec6e505c1 chore: add husky for repository deployments 2019-09-29 16:35:44 +02:00
Cedric van Putten 22df52e066 chore: add all missing tests 2019-09-29 16:35:44 +02:00
Cedric van Putten 98b1bea09b feat: add new expo action cli install concept 2019-09-29 16:35:44 +02:00
Cedric van Putten e72ddd8c15 refactor: remove travis config and base images
The future action will change to a JavaScript action that installs the Expo CLI globally. It should consist of multiple caching mechanisms to ensure fast consecutive builds.
2019-09-29 16:35:44 +02:00
Cedric van Putten 26c734a57d docs: simplify and link the environment variables info 2019-09-29 16:35:44 +02:00
Cedric van Putten f3bc71a12a docs: replace aliased email with normal email 2019-09-29 16:35:44 +02:00
Cedric van Putten 4766fa83e2 docs: write about entry point proxy and restructure for easy access 2019-09-29 16:35:44 +02:00
Cedric van Putten caf499b677 refactor: move entry point to expo as proxy 2019-09-29 16:35:44 +02:00
Cedric van Putten 5cfaee20e5 refactor: update proxy for non-interactive mode and help links 2019-09-29 16:35:44 +02:00
Cedric van Putten 81344e4392 feat: use new action metadata format 2019-09-29 16:35:44 +02:00
Cedric van Putten 89005bc95d docs: update license dates 2019-09-29 16:35:44 +02:00
Cedric van Putten 55b9dc47a8 release: new release for expo cli v3 2019-07-23 00:32:00 +02:00
Cedric van Putten 882d5f940b refactor: run travis in parallel for expo cli v2 and v3 2019-07-23 00:23:39 +02:00
Cedric van Putten cd33736735 refactor: add latest expo-cli v3 but keep v2 images updated 2019-07-23 00:23:39 +02:00
Cedric van Putten d1909bbd24 release: new release for image build with yarn 2019-05-09 00:23:37 +02:00
Cedric van Putten d9cb1dbb0e fix: use yarn to install expo cli globally
This is related to NPM failing for both iltorb and sharp dependencies. Let's work around this by using Yarn for now.

https://github.com/expo/expo-cli/issues/591
2019-05-09 00:20:19 +02:00
Cedric van Putten aff8989f53 release: new release for node memory limit fix 2019-04-17 00:24:06 +02:00
Cedric van Putten 698a1c68a5 chore: make travis build the action to double check the docker file 2019-04-17 00:01:01 +02:00
Cedric van Putten 4c25ef9693 fix: increase node memory limit to 4gb 2019-04-17 00:01:01 +02:00
Cedric van Putten aa752f2bde docs: add note about overwriting node options 2019-04-17 00:01:01 +02:00
Cedric van Putten fa422416ae docs: add extra link to base image in description 2019-04-14 18:28:04 +02:00
Cedric van Putten 92beb0f493 docs: rename build action to remove ambiguity with other examples 2019-04-14 18:24:01 +02:00
Cedric van Putten fe96c9dc68 release: create new release under expo and without subactions 2019-04-14 13:48:50 +02:00
Cedric van Putten a801b833a5 docs: add scheduled builds info and update examples 2019-04-14 13:42:19 +02:00
Cedric van Putten 2c88f88370 docs: add travis link to base image builds 2019-04-14 13:36:21 +02:00
Cedric van Putten 0ce8eff16c feat: build docker base image from travis ci
This will ensure staying up to date and should add some transparency how these images are made.
2019-04-14 13:36:21 +02:00
Cedric van Putten 4e2fd4d394 refactor: update base image labels 2019-04-14 13:12:08 +02:00
Cedric van Putten 3f55e8c261 docs: add 650 industries aka expo as license holder 2019-04-14 13:12:08 +02:00
Cedric van Putten b8ec50268d refactor: remove unofficial from the name 2019-04-14 13:06:53 +02:00
Cedric van Putten 0cfae07bbd refactor: remove deprecated subactions 2019-04-14 13:02:15 +02:00
Cedric van Putten fe86cd6f46 docs: add 650 industries aka expo as license holder 2019-04-14 13:01:47 +02:00
Cedric van Putten 617ebf80c7 docs: update references to action repository 2019-04-14 13:01:27 +02:00
Cedric van Putten e6a3b5c87a docs: use latest npm action because of an install failure
I'm not 100% sure why it happens, but there might be something wrong with the `1.0.0` version on this action. I think they are on 2 now, but it isn't "released" yet.
2019-04-10 23:39:48 +02:00
Cedric van Putten 96ead1e418 release: create renamed environment variables release 2019-04-10 23:15:17 +02:00
Cedric van Putten cd75584edf refactor: use better expo cli variables prefix
The password is already being picked up in the Expo CLI itself, so it's better to keep the same structure.

https://github.com/expo/expo-cli/blob/master/packages/expo-cli/src/accounts.js#L93
2019-04-10 23:11:46 +02:00
Cedric van Putten 3c768431d6 docs: pin actions to versions for future releases 2019-04-10 14:14:42 +02:00
50 changed files with 84876 additions and 588 deletions

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
---
version: 2
scripts: &scripts
steps:
- checkout
- run: npm ci
- run: npm test
- run: npm run lint
- run: npm run 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
workflows:
version: 2
build:
jobs:
- node-10
- node-12
- node-13
+28
View File
@@ -0,0 +1,28 @@
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"jest"
],
"env": {
"es6": true,
"jest/globals": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/indent": ["error", "tab"],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off"
}
}
+1
View File
@@ -0,0 +1 @@
node_modules
+182 -38
View File
@@ -1,52 +1,196 @@
## [2.1.0](https://github.com/bycedric/ci-expo/compare/2.0.0...2.1.0) (2019-04-10)
## [5.0.0](https://github.com/expo/expo-github-action/compare/4.1.0...5.0.0) (2019-12-31)
### Code refactors
### BREAKING CHANGES
* authenticate in main action if possible ([a401e30](https://github.com/bycedric/ci-expo/commit/a401e30))
* remove extraneous commands from base image ([a90ce59](https://github.com/bycedric/ci-expo/commit/a90ce59))
### Documentation changes
* add deprecation notice on all sub-actions ([b5a0311](https://github.com/bycedric/ci-expo/commit/b5a0311))
* add examples and more contextual info ([9625bb1](https://github.com/bycedric/ci-expo/commit/9625bb1))
* fix typo in documentation and use link references ([48bbaf3](https://github.com/bycedric/ci-expo/commit/48bbaf3))
* update license to 2019 ([7596f6b](https://github.com/bycedric/ci-expo/commit/7596f6b))
### Other chores
* add some issue templates to github ([9aec1f5](https://github.com/bycedric/ci-expo/commit/9aec1f5))
## [2.0.0](https://github.com/bycedric/ci-expo/compare/906c910...2.0.0) (2019-04-02)
* use yarn by default instead of npm ([#32](https://github.com/expo/expo-github-action/pull/32)) ([2de5b8c3](https://github.com/expo/expo-github-action/commit/2de5b8c))
* use ncc to compile scripts ([#31](https://github.com/expo/expo-github-action/pull/31)) ([48288d58](https://github.com/expo/expo-github-action/commit/48288d5))
### New features
* add basic ios build action ([3a81415](https://github.com/bycedric/ci-expo/commit/3a81415))
* add basic web build action ([3d4bdb6](https://github.com/bycedric/ci-expo/commit/3d4bdb6))
* add basic android build action ([9105177](https://github.com/bycedric/ci-expo/commit/9105177))
* add new publish action ([56563f2](https://github.com/bycedric/ci-expo/commit/56563f2))
* add login entrypoint ([252f16d](https://github.com/bycedric/ci-expo/commit/252f16d))
* add github actions implemented image for expo cli ([864b9bb](https://github.com/bycedric/ci-expo/commit/864b9bb))
* add base image with documentation and licenses ([c43e5c3](https://github.com/bycedric/ci-expo/commit/c43e5c3))
* implement caching using github actions cache ([#35](https://github.com/expo/expo-github-action/pull/35)) ([69801f0a](https://github.com/expo/expo-github-action/commit/69801f0))
### Code refactors
* tag all buid actions as unofficial for release ([ed597e5](https://github.com/bycedric/ci-expo/commit/ed597e5))
* simplify publish action and remove extraneous entrypoint ([61d0c21](https://github.com/bycedric/ci-expo/commit/61d0c21))
* tag all actions as unofficial for release to marketplace ([f56443a](https://github.com/bycedric/ci-expo/commit/f56443a))
* expand existing login with documentation and proper icon ([d2e2a6d](https://github.com/bycedric/ci-expo/commit/d2e2a6d))
* move cli to root as default ([4545e44](https://github.com/bycedric/ci-expo/commit/4545e44))
* expand existing login with documentation and proper icon ([923ed34](https://github.com/bycedric/ci-expo/commit/923ed34))
* remove third party notice until its updated ([f4fc39a](https://github.com/bycedric/ci-expo/commit/f4fc39a))
* use full node version instead of alpine ([a019c94](https://github.com/bycedric/ci-expo/commit/a019c94))
* move index code to run ([#33](https://github.com/expo/expo-github-action/pull/33)) ([f80ef1f6](https://github.com/expo/expo-github-action/commit/f80ef1f))
* use yarn by default instead of npm ([#32](https://github.com/expo/expo-github-action/pull/32)) ([2de5b8c3](https://github.com/expo/expo-github-action/commit/2de5b8c))
* use ncc to compile scripts ([#31](https://github.com/expo/expo-github-action/pull/31)) ([48288d58](https://github.com/expo/expo-github-action/commit/48288d5))
* make logs more visible ([#30](https://github.com/expo/expo-github-action/pull/30)) ([12f58a21](https://github.com/expo/expo-github-action/commit/12f58a2))
* update all dependencies to latest versions ([#29](https://github.com/expo/expo-github-action/pull/29)) ([7776e33f](https://github.com/expo/expo-github-action/commit/7776e33))
* use circleci instead of github actions ([#28](https://github.com/expo/expo-github-action/pull/28)) ([e5677e1f](https://github.com/expo/expo-github-action/commit/e5677e1))
### Documentation changes
* add link to login from publish action ([5b7564c](https://github.com/bycedric/ci-expo/commit/5b7564c))
* add custom cli command action ([4cf38f9](https://github.com/bycedric/ci-expo/commit/4cf38f9))
* add do not use in production warning ([8291794](https://github.com/bycedric/ci-expo/commit/8291794))
* add basic repository description ([906c910](https://github.com/bycedric/ci-expo/commit/906c910))
* update the default packager value in action ([#34](https://github.com/expo/expo-github-action/pull/34)) ([3ac4a96c](https://github.com/expo/expo-github-action/commit/3ac4a96))
### Other chores
* remove the cli from name ([ab9265b](https://github.com/bycedric/ci-expo/commit/ab9265b))
* **deps**: bump handlebars from 4.2.0 to 4.5.3 ([#27](https://github.com/expo/expo-github-action/pull/27)) ([4aa2c230](https://github.com/expo/expo-github-action/commit/4aa2c23))
## [4.1.0](https://github.com/expo/expo-github-action/compare/4.0.1...4.1.0) (2019-10-30)
### Bug fixes
* use cmd suffix when authenticating on windows ([831bcb1](https://github.com/expo/expo-github-action/commit/831bcb1))
### Documentation changes
* remove beta warning just before general availability ([68a2de0](https://github.com/expo/expo-github-action/commit/68a2de0))
### Other chores
* update all dependencies to latest version ([16d4b15](https://github.com/expo/expo-github-action/commit/16d4b15))
* enable workflow for pull requests ([8ff07e0](https://github.com/expo/expo-github-action/commit/8ff07e0))
## [4.0.0](https://github.com/expo/expo-github-action/compare/3.0.0...4.0.0) (2019-09-29)
### New features
* add github workflow for ci ([929a76c](https://github.com/expo/expo-github-action/commit/929a76c))
* add new expo action cli install concept ([98b1bea](https://github.com/expo/expo-github-action/commit/98b1bea))
* use new action metadata format ([81344e4](https://github.com/expo/expo-github-action/commit/81344e4))
### Bug fixes
* add build and node node modules before commit ([00692c4](https://github.com/expo/expo-github-action/commit/00692c4))
* add build and node node modules in husky hook ([b2929e3](https://github.com/expo/expo-github-action/commit/b2929e3))
### Code refactors
* remove travis config and base images ([e72ddd8](https://github.com/expo/expo-github-action/commit/e72ddd8))
* move entry point to expo as proxy ([caf499b](https://github.com/expo/expo-github-action/commit/caf499b))
* update proxy for non-interactive mode and help links ([5cfaee2](https://github.com/expo/expo-github-action/commit/5cfaee2))
### Documentation changes
* update documentation for the new action ([38e963b](https://github.com/expo/expo-github-action/commit/38e963b))
* simplify and link the environment variables info ([26c734a](https://github.com/expo/expo-github-action/commit/26c734a))
* replace aliased email with normal email ([f3bc71a](https://github.com/expo/expo-github-action/commit/f3bc71a))
* write about entry point proxy and restructure for easy access ([4766fa8](https://github.com/expo/expo-github-action/commit/4766fa8))
* update license dates ([89005bc](https://github.com/expo/expo-github-action/commit/89005bc))
### Other chores
* add linter and fix all files ([04cd479](https://github.com/expo/expo-github-action/commit/04cd479))
* add husky for repository deployments ([cec6e50](https://github.com/expo/expo-github-action/commit/cec6e50))
* add all missing tests ([22df52e](https://github.com/expo/expo-github-action/commit/22df52e))
## [3.0.0](https://github.com/expo/expo-github-action/compare/2.3.2...3.0.0) (2019-07-23)
## Code refactors
* run travis in parallel for expo cli v2 and v3 ([882d5f9](https://github.com/expo/expo-github-action/commit/882d5f9))
* add latest expo-cli v3 but keep v2 images updated ([cd33736](https://github.com/expo/expo-github-action/commit/cd33736))
## [2.3.2](https://github.com/expo/expo-github-action/compare/2.3.1...2.3.2) (2019-05-09)
### Bug fixes
* use yarn to install expo cli globally ([9fd3635](https://github.com/expo/expo-github-action/commit/9fd3635))
## [2.3.1](https://github.com/expo/expo-github-action/compare/2.3.0...2.3.1) (2019-04-17)
### Bug fixes
* increase node memory limit to 4gb ([4c25ef9](https://github.com/expo/expo-github-action/commit/4c25ef9))
### Documentation changes
* add note about overwriting node options ([aa752f2](https://github.com/expo/expo-github-action/commit/aa752f2))
* add extra link to base image in description ([fa42241](https://github.com/expo/expo-github-action/commit/fa42241))
* rename build action to remove ambiguity with other examples ([92beb0f](https://github.com/expo/expo-github-action/commit/92beb0f))
### Other chores
* make travis build the action to double check the docker file ([698a1c6](https://github.com/expo/expo-github-action/commit/698a1c6))
## [2.3.0](https://github.com/expo/expo-github-action/compare/2.2.0...2.3.0) (2019-04-14)
### New features
* build docker base image from travis ci ([0ce8eff](https://github.com/expo/expo-github-action/commit/0ce8eff))
### Code refactors
* update base image labels ([4e2fd4d](https://github.com/expo/expo-github-action/commit/4e2fd4d))
* remove unofficial from the name ([b8ec502](https://github.com/expo/expo-github-action/commit/b8ec502))
* remove deprecated subactions ([0cfae07](https://github.com/expo/expo-github-action/commit/0cfae07))
### Documentation changes
* add scheduled builds info and update examples ([a801b83](https://github.com/expo/expo-github-action/commit/a801b83))
* add travis link to base image builds ([2c88f88](https://github.com/expo/expo-github-action/commit/2c88f88))
* add 650 industries aka expo as license holder ([3f55e8c](https://github.com/expo/expo-github-action/commit/3f55e8c))
* add 650 industries aka expo as license holder ([fe86cd6](https://github.com/expo/expo-github-action/commit/fe86cd6))
* update references to action repository ([617ebf8](https://github.com/expo/expo-github-action/commit/617ebf8))
* use latest npm action because of an install failure ([e6a3b5c](https://github.com/expo/expo-github-action/commit/e6a3b5c))
## [2.2.0](https://github.com/expo/expo-github-action/compare/2.1.0...2.2.0) (2019-04-10)
### Code refactors
* use better expo cli variables prefix ([cd75584](https://github.com/expo/expo-github-action/commit/cd75584))
### Documentation changes
* pin actions to versions for future releases ([3c76843](https://github.com/expo/expo-github-action/commit/3c76843))
## [2.1.0](https://github.com/expo/expo-github-action/compare/2.0.0...2.1.0) (2019-04-10)
### Code refactors
* authenticate in main action if possible ([a401e30](https://github.com/expo/expo-github-action/commit/a401e30))
* remove extraneous commands from base image ([a90ce59](https://github.com/expo/expo-github-action/commit/a90ce59))
### Documentation changes
* add deprecation notice on all sub-actions ([b5a0311](https://github.com/expo/expo-github-action/commit/b5a0311))
* add examples and more contextual info ([9625bb1](https://github.com/expo/expo-github-action/commit/9625bb1))
* fix typo in documentation and use link references ([48bbaf3](https://github.com/expo/expo-github-action/commit/48bbaf3))
* update license to 2019 ([7596f6b](https://github.com/expo/expo-github-action/commit/7596f6b))
### Other chores
* add some issue templates to github ([9aec1f5](https://github.com/expo/expo-github-action/commit/9aec1f5))
## [2.0.0](https://github.com/expo/expo-github-action/compare/906c910...2.0.0) (2019-04-02)
### New features
* add basic ios build action ([3a81415](https://github.com/expo/expo-github-action/commit/3a81415))
* add basic web build action ([3d4bdb6](https://github.com/expo/expo-github-action/commit/3d4bdb6))
* add basic android build action ([9105177](https://github.com/expo/expo-github-action/commit/9105177))
* add new publish action ([56563f2](https://github.com/expo/expo-github-action/commit/56563f2))
* add login entrypoint ([252f16d](https://github.com/expo/expo-github-action/commit/252f16d))
* add github actions implemented image for expo cli ([864b9bb](https://github.com/expo/expo-github-action/commit/864b9bb))
* add base image with documentation and licenses ([c43e5c3](https://github.com/expo/expo-github-action/commit/c43e5c3))
### Code refactors
* tag all buid actions as unofficial for release ([ed597e5](https://github.com/expo/expo-github-action/commit/ed597e5))
* simplify publish action and remove extraneous entrypoint ([61d0c21](https://github.com/expo/expo-github-action/commit/61d0c21))
* tag all actions as unofficial for release to marketplace ([f56443a](https://github.com/expo/expo-github-action/commit/f56443a))
* expand existing login with documentation and proper icon ([d2e2a6d](https://github.com/expo/expo-github-action/commit/d2e2a6d))
* move cli to root as default ([4545e44](https://github.com/expo/expo-github-action/commit/4545e44))
* expand existing login with documentation and proper icon ([923ed34](https://github.com/expo/expo-github-action/commit/923ed34))
* remove third party notice until its updated ([f4fc39a](https://github.com/expo/expo-github-action/commit/f4fc39a))
* use full node version instead of alpine ([a019c94](https://github.com/expo/expo-github-action/commit/a019c94))
### Documentation changes
* add link to login from publish action ([5b7564c](https://github.com/expo/expo-github-action/commit/5b7564c))
* add custom cli command action ([4cf38f9](https://github.com/expo/expo-github-action/commit/4cf38f9))
* add do not use in production warning ([8291794](https://github.com/expo/expo-github-action/commit/8291794))
* add basic repository description ([906c910](https://github.com/expo/expo-github-action/commit/906c910))
### Other chores
* remove the cli from name ([ab9265b](https://github.com/expo/expo-github-action/commit/ab9265b))
-10
View File
@@ -1,10 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Expo CLI (unofficial)"
LABEL com.github.actions.description="Use any Expo CLI command in your GitHub Actions workflow."
LABEL com.github.actions.icon="terminal"
LABEL com.github.actions.color="gray-dark"
COPY entrypoint.sh LICENSE.md README.md /
entrypoint ["/entrypoint.sh"]
+2 -1
View File
@@ -1,6 +1,7 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
Copyright (c) 2019-present Cedric van Putten <me@bycedric.com>
Copyright (c) 2019-present 650 Industries, Inc. (aka Expo)
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
+206 -113
View File
@@ -1,146 +1,230 @@
# Expo for GitHub Actions
# Expo GitHub Action
> GitHub Actions is still in beta, use it at your own risk.
Publish, build, or manage your [Expo][link-expo] project with GitHub Actions!
This action installs the [Expo CLI][link-expo-cli] on your preferred os and authenticates your project.
You can also use [the Docker image][link-docker-expo] in other Docker-based environments.
Publish, build or manage your [Expo][link-expo] Project with GitHub Actions!
This repository contains a prebuilt base image with GitHub Actions implementations.
You can also use [the base image](base) in other Docker-based environments.
1. [What's inside?](#whats-inside)
2. [Used variables](#used-variables)
3. [Example workflows](#example-workflows)
4. [Things to know](#things-to-know)
## What's inside?
Within this Expo CLI action, you have full access to the original [Expo CLI][link-expo-cli].
That means you are able to perform any command like login, publish and build.
Also, this action will authenticate automatically when both `EXPO_USERNAME` and `EXPO_PASSWORD` variables are defined.
Within this Expo action, you have full access to the [Expo CLI][link-expo-cli] itself.
That means you can perform any command like login, publish, and build.
Also, this action takes care of authentication when both `expo-username` and `expo-password` variables are defined.
> You don't necessarily need this action to use Expo.
> You can also add `expo-cli` as a dependency to your project and use the official [NPM action][link-actions-npm] for example.
> However, when you do that you need to manage authentication yourself.
## Used variables
### Why use a base-image?
This action is customizable through variables; they are defined in the [`action.yml`][link-expo-cli-action].
Here is a summary of all the variables that you can use and their purpose.
Every GitHub action will start from scratch, using the dockerfile as the starting point.
If you define `expo-cli` in this dockerfile, it will install it every time you run an action.
By using a prebuilt image, it basically "skips" the process of downloading the full CLI over and over again.
This makes the Expo actions overall faster.
variable | description
--- | ---
`expo-username` | The username of your Expo account. _(you can hardcode this or use secrets)_
`expo-password` | The password of your Expo account. _**([use this with secrets][link-actions-secrets])**_
`expo-version` | The Expo CLI you want to use. _(can be any semver range, defaults to `latest`)_
`expo-packager` | The package manager you want to use to install the CLI. _(can be `npm` or `yarn`, defaults to `yarn`)_
`expo-cache` | If it should the actions cache, [read more about it here](#using-the-built-in-cache) _(can be `true` or `false`, defaults to `false`)_
`expo-cache-key` | An optional custom remote cache key _(**warning**, only use this when you know what you are doing)_
`expo-patch-watchers` | If it should patch the `fs.inotify.` limits causing `ENOSPC` errors on Linux. _(can be `true` or `false`, defaults to `true`)_
### Used secrets
To authenticate with your Expo account, use the variables listed below.
In the Expo action you can define `secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]` to have them available.
variable | description
--- | ---
`EXPO_USERNAME` | The email address or username of your Expo account.
`EXPO_PASSWORD` | The password of your Expo account.
> Some Expo commands don't require authentication.
> Simply omit the `secrets = [...]` if you don't need it.
> It's recommended to set the `expo-version` to avoid breaking changes when a new major version is released.
> For more info on how to use this, please read the [workflow syntax documentation][link-actions-syntax-with].
## Example workflows
Before you dive into the workflow examples, you should know the basics of GitHub Actions.
You can read more about this in the [GitHub Actions documentation][link-actions].
1. [Publish on any push](#publish-on-any-push)
2. [Publish on a specific branch](#publish-on-a-specific-branch)
3. [Test and build web every day at 08:00](#test-and-build-web-every-day-at-0800)
1. [Publish on any push to master](#publish-on-any-push-to-master)
2. [Cache Expo CLI for other jobs](#cache-expo-cli-for-other-jobs)
3. [Test PRs and publish a review version](#test-prs-and-publish-a-review-version)
4. [Test PRs on multiple nodes and systems](#test-prs-on-multiple-nodes-and-systems)
5. [Test and build web every day at 08:00](#test-and-build-web-every-day-at-0800)
### Publish on any push
### Publish on any push to master
Below you can see the example configuration to publish whenever the repository is updated.
The workflow listens to the `push` event and resolves directly to the `publish` action.
Before publishing your app, it installs your project's dependencies using the [NPM action][link-actions-npm].
Below you can see the example configuration to publish whenever the master branch is updated.
The workflow listens to the `push` event and sets up Node 12 using the [Setup Node Action][link-actions-node].
It also authenticates the Expo project by defining both `expo-username` and `expo-password`.
```hcl
workflow "Install and Publish" {
on = "push"
resolves = ["Publish"]
}
action "Install" {
uses = "actions/npm@master"
args = "install"
}
action "Publish" {
needs = "Install"
uses = "bycedric/ci-expo@master"
args = "publish"
secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]
}
```yml
name: Expo Publish
on:
push:
branches:
- master
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: expo/expo-github-action@v5
with:
expo-version: 3.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
- run: yarn install
- run: expo publish
```
### Publish on a specific branch
### Cache Expo CLI for other jobs
This workflow is similar to the [publish on any push](#publish-on-any-push) configuration.
It will install and test the code using the [NPM action][link-actions-npm] on every push.
But instead of publishing on any push too, it will publish on the `master` branch only.
Below you can see a slightly modified version of the example above.
In this one, we enabled the built-in cache that will reuse a previous installed Expo CLI.
This skips the installation part and extracts the files directly, boosting the performance of your workflow.
```hcl
workflow "Install and Publish" {
on = "push"
resolves = ["Publish"]
}
> You can [read more about the cache here](#using-the-built-in-cache)
action "Install" {
uses = "actions/npm@master"
args = "install"
}
```yml
name: Expo Publish
on:
push:
branches:
- master
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: expo/expo-github-action@v5
with:
expo-version: 3.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
expo-cache: true
- run: yarn install
- run: expo publish
```
action "Test" {
needs = "Install"
uses = "actions/npm@master"
args = "test"
}
### Test PRs and publish a review version
action "Filter branch" {
needs = "Test"
uses = "actions/bin/filter@master"
args = "branch master"
}
Reviewing pull requests can take some time if you have to read every line of code.
To make this easier, you can publish the edited version of the PR using a dedicated release channel.
Below you can see an example of a workflow that publishes and comments when the app is ready for review.
action "Publish" {
needs = "Filter branch"
uses = "bycedric/ci-expo@master"
args = "publish"
secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]
}
```yml
name: Expo Review
on: [pull_request]
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: expo/expo-github-action@v5
with:
expo-version: 3.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
- run: yarn install
- run: expo publish --release-channel=pr-${{ github.event.number }}
- uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: App is ready for review, you can [see it here](https://expo.io/@bycedric/use-expo?release-channel=pr-${{ github.event.number }}).
```
### Test PRs on multiple nodes and systems
With GitHub Actions, it's reasonably easy to set up a matrix build and test the app on multiple environments.
These matrixes can help to make sure your app runs smoothly on a broad set of different development machines.
The action below is only running on pull requests to avoid unnecessary builds.
> If you don't need automatic authentication, you can omit the `expo-username` and `expo-password` variables.
```yml
name: Expo CI
on: [pull_request]
jobs:
ci:
name: Continuous Integration
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node: [10, 12, 13]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: expo/expo-github-action@v5
with:
expo-version: 3.x
- run: yarn install
- run: yarn test
- run: expo doctor
```
### Test and build web every day at 08:00
You can add as many extra steps in a workflow as you want.
Here we've added a test step, that basically invokes `npm test` using the [NPM action][link-actions-npm].
It also doesn't listen to push events.
Instead, it's scheduled to run every day at 08:00.
You can also schedule jobs by using the cron syntax.
It helps you update or check your app now and then.
For example, the [Expo CLI Docker images uses this][link-docker-expo-cron] to make sure the images are up to date.
> For web builds, you don't need to be authenticated.
> That's why `secrets = [...]` is omitted here.
```hcl
workflow "Install, Test and Build Web" {
on = "schedule(0 8 * * *)"
resolves = ["Publish"]
}
action "Install" {
uses = "actions/npm@master"
args = "install"
}
action "Test" {
needs = "Install"
uses = "actions/npm@master"
args = "test"
}
action "Publish" {
needs = "Test"
uses = "bycedric/ci-expo@master"
args = "build:web"
}
```yml
name: Expo Daily CI
on:
schedule:
- cron: 0 8 * * *
jobs:
ci:
name: Daily Continuous Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: expo/expo-github-action@v5
with:
expo-version: 3.x
- run: yarn install
- run: yarn test
- run: expo build:web
```
## Things to know
### Automatic Expo login
You need to authenticate for some Expo commands as `expo publish` and `expo build:*`.
This project has an additional feature to make this easy and secure.
The action uses the [`EXPO_CLI_PASSWORD`][link-expo-cli-password] variable internally to make this happen.
### Using the built-in cache
As of writing, GitHub Actions lacks a feature to "cache" files and directories in 3rd party actions.
That's why we implemented the [Cypress fork of the `actions/cache`][link-actions-cache-cypress] to enable some sort of caching.
You can opt-in to this by setting the `expo-cache` variable to `true`.
If you know what you are doing and need more control, you can also define a custom cache key with `expo-cache-key`.
> Note, this cache will count towards your [repo cache limit][link-actions-cache-limit].
### ENOSPC errors on Linux
React Native bundles are created by the Metro bundler, even when using Expo.
Unfortunately, this Metro bundler requires quite some resources.
As of writing, GitHub Actions has some small default values for the `fs.inotify` settings.
Inside we included a patch that increases these limits for the "active workflow" run.
It increases the `max_user_instances`, `max_user_watches` and `max_queued_events` to `524288`.
You can disable this patch by setting the `expo-patch-watchers` to `false`.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
@@ -148,10 +232,19 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
[link-actions]: https://developer.github.com/actions/
[link-actions-npm]: https://github.com/actions/npm
[link-actions]: https://help.github.com/en/categories/automating-your-workflow-with-github-actions
[link-actions-cache]: https://github.com/actions/cache
[link-actions-cache-cypress]: https://github.com/cypress-io/github-actions-cache
[link-actions-cache-limit]: https://github.com/actions/cache#cache-limits
[link-actions-node]: https://github.com/actions/setup-node
[link-actions-secrets]: https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables
[link-actions-syntax-with]: https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith
[link-docker-expo]: https://github.com/bycedric/expo-cli-images
[link-docker-expo-cron]: https://github.com/byCedric/expo-cli-images/blob/d93389e52135d6a599853aed7893adc6a8b57c84/.github/workflows/daily-builds.yml#L5
[link-expo]: https://expo.io
[link-expo-cli]: https://docs.expo.io/versions/latest/workflow/expo-cli
[link-expo-cli-action]: action.yml
[link-expo-cli-password]: https://github.com/expo/expo-cli/blob/8ea616d8848a123270b97e226e33dcb3dde49653/packages/expo-cli/src/accounts.js#L94
+29
View File
@@ -0,0 +1,29 @@
---
name: Expo GitHub Action
author: Cedric van Putten <[email protected]>
description: Expo CLI in your GitHub Actions workflow.
branding:
icon: terminal
color: gray-dark
runs:
using: node12
main: build/index.js
input:
expo-version:
description: The Expo CLI version to install. (use any semver/dist-tag available)
default: latest
expo-username:
description: Your Expo username, for authentication.
expo-password:
description: Your Expo password, for authentication. (use with secrets)
expo-packager:
description: The package manager used to install the Expo CLI. (can be yarn or npm)
default: yarn
expo-patch-watchers:
description: If Expo should fix the default watchers limit, helps with ENOSPC errors. (can be true or false)
default: true
expo-cache:
description: If Expo should be stored in the GitHub Actions cache (can be true or false)
default: false
expo-cache-key:
description: A custom remote cache key to use (best to let GitHub Actions handle it)
-14
View File
@@ -1,14 +0,0 @@
FROM node:10
LABEL name="Expo for Docker"
LABEL repository="https://github.com/bycedric/ci-expo"
LABEL homepage="https://github.com/bycedric/ci-expo/tree/master/base"
LABEL maintainer="Cedric van Putten <[email protected]>"
RUN npm install --global expo-cli@2 \
&& npm cache rm --force \
&& rm -rf ~/.npm
COPY entrypoint.sh LICENSE.md README.md /
ENTRYPOINT ["/entrypoint.sh"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-37
View File
@@ -1,37 +0,0 @@
# Expo for Docker
A prebuilt docker image to use the [Expo CLI][link-expo-cli] on Docker-based environments.
This image contains all necessary libraries to perform all commands of the CLI.
- Based on `node:10` image
- Contains globally installed `expo-cli@2`
## Usage
The entry point of this image forwards to the Expo CLI itself.
With this entry point, you can provide any command directly to Docker.
When nothing is provided, it will output the help information provided by the CLI.
> The entry point uses `sh -c` to invoke Expo, making environment variables available to that command.
```bash
$ docker run --rm bycedric/ci-expo
$ docker run --rm bycedric/ci-expo pubish
$ docker run --rm -ti bycedric/ci-expo login
$ docker run --rm -ti --entrypoint sh bycedric/ci-expo
```
> This image is intended to use on Docker-based CI environments, see [the Expo CI guide][link-expo-cicd] to get started.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
[link-expo-cli]: https://docs.expo.io/versions/latest/workflow/expo-cli
[link-expo-cicd]: https://docs.expo.io/versions/latest/guides/setting-up-continuous-integration
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh -l
set -e
sh -c "expo $*"
-8
View File
@@ -1,8 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Build Expo Android app (unofficial)"
LABEL com.github.actions.description="Create a standalone Android app in your GitHub Actions workflow."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"
ENTRYPOINT ["/entrypoint.sh", "build:android"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-31
View File
@@ -1,31 +0,0 @@
# Expo Build Android for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Create a new standalone Android build from your GitHub workflow.
Optionally, you can configure the properties of this standalone app.
> Make sure to [login](../login) before this step, else your workflow won't have the permission to build a new version
## Usage
Below you can see an example of a build Android action.
> Just like the [publish](../publish) action, you can customize the Android app.
```hcl
action "Build Android app" {
uses = "bycedric/ci-expo/build-android@master"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
-8
View File
@@ -1,8 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Build Expo iOS app (unofficial)"
LABEL com.github.actions.description="Create a standalone iOS app in your GitHub Actions workflow."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"
ENTRYPOINT ["/entrypoint.sh", "build:ios"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-31
View File
@@ -1,31 +0,0 @@
# Expo Build iOS for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Create a new standalone iOS build from your GitHub workflow.
Optionally, you can configure the properties of this standalone app.
> Make sure to [login](../login) before this step, else your workflow won't have the permission to build a new version
## Usage
Below you can see an example of a build iOS action.
> Just like the [publish](../publish) action, you can customize the iOS app.
```hcl
action "Build iOS app" {
uses = "bycedric/ci-expo/build-ios@master"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
-8
View File
@@ -1,8 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Build Expo web bundle (unofficial)"
LABEL com.github.actions.description="Create a bundle for web deployments from your GitHub Actions workflow."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"
ENTRYPOINT ["/entrypoint.sh", "build:web"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-31
View File
@@ -1,31 +0,0 @@
# Expo Build Web for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Create a new app web bundle from your GitHub workflow.
Optionally, you can configure the properties of this bundle.
> Authentication is not required for this step.
## Usage
Below you can see an example of a build web action.
> Just like the [publish](../publish) action, you can customize the web bundle.
```hcl
action "Build web bundle" {
uses = "bycedric/ci-expo/build-web@master"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
+24
View File
@@ -0,0 +1,24 @@
if (module !== require.main) {
throw new Error("This file should not be loaded with require()")
}
if (!process.getuid || !process.getgid) {
throw new Error("this file should not be called without uid/gid support")
}
var argv = process.argv.slice(2)
, user = argv[0] || process.getuid()
, group = argv[1] || process.getgid()
if (!isNaN(user)) user = +user
if (!isNaN(group)) group = +group
console.error([user, group])
try {
process.setgid(group)
process.setuid(user)
console.log(JSON.stringify({uid:+process.getuid(), gid:+process.getgid()}))
} catch (ex) {
console.log(JSON.stringify({error:ex.message,errno:ex.errno}))
}
+76466
View File
File diff suppressed because it is too large. Load diff
+47
View File
@@ -0,0 +1,47 @@
'use strict'
const ls = require('../ls.js')
const get = require('../get.js')
const put = require('../put.js')
const rm = require('../rm.js')
const verify = require('../verify.js')
const setLocale = require('../lib/util/y.js').setLocale
const clearMemoized = require('../lib/memoization.js').clearMemoized
const tmp = require('../lib/util/tmp.js')
setLocale('en')
const x = module.exports
x.ls = cache => ls(cache)
x.ls.stream = cache => ls.stream(cache)
x.get = (cache, key, opts) => get(cache, key, opts)
x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts)
x.get.sync = (cache, key, opts) => get.sync(cache, key, opts)
x.get.sync.byDigest = (cache, key, opts) => get.sync.byDigest(cache, key, opts)
x.get.stream = (cache, key, opts) => get.stream(cache, key, opts)
x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts)
x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts)
x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts)
x.get.info = (cache, key) => get.info(cache, key)
x.get.hasContent = (cache, hash) => get.hasContent(cache, hash)
x.get.hasContent.sync = (cache, hash) => get.hasContent.sync(cache, hash)
x.put = (cache, key, data, opts) => put(cache, key, data, opts)
x.put.stream = (cache, key, opts) => put.stream(cache, key, opts)
x.rm = (cache, key) => rm.entry(cache, key)
x.rm.all = cache => rm.all(cache)
x.rm.entry = x.rm
x.rm.content = (cache, hash) => rm.content(cache, hash)
x.setLocale = lang => setLocale(lang)
x.clearMemoized = () => clearMemoized()
x.tmp = {}
x.tmp.mkdir = (cache, opts) => tmp.mkdir(cache, opts)
x.tmp.withTmp = (cache, opts, cb) => tmp.withTmp(cache, opts, cb)
x.verify = (cache, opts) => verify(cache, opts)
x.verify.lastRun = cache => verify.lastRun(cache)
+7
View File
@@ -0,0 +1,7 @@
{
"No cache entry for `%s` found in `%s`": "No cache entry for %s found in %s",
"Integrity verification failed for %s (%s)": "Integrity verification failed for %s (%s)",
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Bad data size: expected inserted data to be %s bytes, but got %s instead",
"Cache input stream was empty": "Cache input stream was empty",
"Integrity check failed:\n Wanted: %s\n Found: %s": "Integrity check failed:\n Wanted: %s\n Found: %s"
}
+49
View File
@@ -0,0 +1,49 @@
'use strict'
const ls = require('../ls.js')
const get = require('../get.js')
const put = require('../put.js')
const rm = require('../rm.js')
const verify = require('../verify.js')
const setLocale = require('../lib/util/y.js').setLocale
const clearMemoized = require('../lib/memoization.js').clearMemoized
const tmp = require('../lib/util/tmp.js')
setLocale('es')
const x = module.exports
x.ls = cache => ls(cache)
x.ls.flujo = cache => ls.stream(cache)
x.saca = (cache, clave, ops) => get(cache, clave, ops)
x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops)
x.saca.sinc = (cache, clave, ops) => get.sync(cache, clave, ops)
x.saca.sinc.porHacheo = (cache, hacheo, ops) => get.sync.byDigest(cache, hacheo, ops)
x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops)
x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops)
x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts)
x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts)
x.saca.info = (cache, clave) => get.info(cache, clave)
x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo)
x.saca.tieneDatos.sinc = (cache, hacheo) => get.hasContent.sync(cache, hacheo)
x.mete = (cache, clave, datos, ops) => put(cache, clave, datos, ops)
x.mete.flujo = (cache, clave, ops) => put.stream(cache, clave, ops)
x.rm = (cache, clave) => rm.entry(cache, clave)
x.rm.todo = cache => rm.all(cache)
x.rm.entrada = x.rm
x.rm.datos = (cache, hacheo) => rm.content(cache, hacheo)
x.ponLenguaje = lang => setLocale(lang)
x.limpiaMemoizado = () => clearMemoized()
x.tmp = {}
x.tmp.mkdir = (cache, ops) => tmp.mkdir(cache, ops)
x.tmp.hazdir = x.tmp.mkdir
x.tmp.conTmp = (cache, ops, cb) => tmp.withTmp(cache, ops, cb)
x.verifica = (cache, ops) => verify(cache, ops)
x.verifica.ultimaVez = cache => verify.lastRun(cache)
x.verifica.últimaVez = x.verifica.ultimaVez
+6
View File
@@ -0,0 +1,6 @@
{
"No cache entry for `%s` found in `%s`": "No existe ninguna entrada para «%s» en «%s»",
"Integrity verification failed for %s (%s)": "Verificación de integridad falló para «%s» (%s)",
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Tamaño incorrecto de datos: los datos insertados debieron haber sido %s octetos, pero fueron %s",
"Cache input stream was empty": "El stream de entrada al caché estaba vacío"
}
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh -l
set -e
if [ -n "$EXPO_USERNAME" ] && [ -n "$EXPO_PASSWORD" ]; then
expo login --username $EXPO_USERNAME --password $EXPO_PASSWORD
else
echo 'Skipping Expo login, username and/or password not defined...'
fi
sh -c "expo $*"
+10
View File
@@ -0,0 +1,10 @@
module.exports = {
verbose: true,
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
};
-11
View File
@@ -1,11 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Login with Expo (unofficial)"
LABEL com.github.actions.description="Authenticate with Expo your GitHub Actions workflow."
LABEL com.github.actions.icon="log-in"
LABEL com.github.actions.color="gray-dark"
COPY LICENSE.md README.md /
COPY entrypoint.sh /entrypoint-login.sh
ENTRYPOINT ["/entrypoint-login.sh"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-34
View File
@@ -1,34 +0,0 @@
# Expo Login for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Authenticate the current workflow to publish new versions or create new builds.
It works relatively simple, you define the Expo credentials, and this action will do the rest.
## Usage
First you need to define the [secrets listed below][#secrets] through [GitHub secrets](https://developer.github.com/actions/managing-workflows/storing-secrets/).
After that, you can add the action below in your workflow.
```hcl
action "Login with Expo" {
uses = "bycedric/ci-expo/login@master"
secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]
}
```
### Secrets
* `EXPO_USERNAME` - **Required**. The email address or username of the Expo account.
* `EXPO_PASSWORD` - **Required**. The password of the Expo account.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
-10
View File
@@ -1,10 +0,0 @@
#!/bin/sh -l
set -e
if [ -n "$EXPO_USERNAME" ] && [ -n "$EXPO_PASSWORD" ]; then
expo login --username $EXPO_USERNAME --password $EXPO_PASSWORD
else
echo "Please define both EXPO_USERNAME and EXPO_PASSWORD."
exit 1
fi
+7214
View File
File diff suppressed because it is too large. Load diff
+48
View File
@@ -0,0 +1,48 @@
{
"private": true,
"name": "expo-github-action",
"version": "5.0.0",
"description": "Expo CLI in your GitHub Actions workflow",
"main": "build/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/expo/expo-github-action.git"
},
"author": "Cedric van Putten <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/expo-github-action/issues"
},
"homepage": "https://github.com/expo/expo-github-action#readme",
"scripts": {
"test": "jest",
"lint": "tsc --noEmit && eslint src/** tests/**",
"build": "ncc build src/index.ts --out build"
},
"dependencies": {
"@actions/cache": "github:cypress-io/github-actions-cache#8bec6cc",
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.2",
"@actions/io": "^1.0.1",
"@actions/tool-cache": "^1.1.2",
"libnpm": "^3.0.1"
},
"devDependencies": {
"@types/jest": "^24.0.25",
"@types/node": "^12.12.22",
"@typescript-eslint/eslint-plugin": "^2.13.0",
"@typescript-eslint/parser": "^2.13.0",
"@zeit/ncc": "^0.20.5",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.2.0",
"husky": "^3.1.0",
"jest": "^24.9.0",
"ts-jest": "^24.2.0",
"typescript": "^3.7.4"
},
"husky": {
"hooks": {
"pre-commit": "npm run build && git add build"
}
}
}
-10
View File
@@ -1,10 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Publish to Expo (unofficial)"
LABEL com.github.actions.description="Publish a new release to Expo in your GitHub Actions workflow."
LABEL com.github.actions.icon="box"
LABEL com.github.actions.color="gray-dark"
COPY LICENSE.md README.md /
ENTRYPOINT ["/entrypoint.sh", "publish"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-52
View File
@@ -1,52 +0,0 @@
# Expo Publish for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Publish a brand new release straight from your GitHub workflow.
Optionally, you can configure the release channel or manifest file.
> Make sure to [login](../login) before this step, else your workflow won't have the permission to build a new version
## Usage
Below you can see an example of a publish action.
By default, it will publish to the default release channel with the manifest located at `app.json`.
```hcl
action "Publish to Expo" {
uses = "bycedric/ci-expo/publish@master"
}
```
### Release channels
You can also use a different release channel, to test before the actual build goes live for example.
```hcl
action "Publish to Expo" {
uses = "bycedric/ci-expo/publish@master"
args = "--release-channel staging"
}
```
### Custom manifest
When using non-default locations for the manifest, you can use the `--config` argument.
```hcl
action "Publish to Expo" {
uses = "bycedric/ci-expo/publish@master"
args = "--config custom-app.json"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
+66
View File
@@ -0,0 +1,66 @@
import { restoreCache, saveCache } from '@actions/cache/lib';
import * as core from '@actions/core';
import * as toolCache from '@actions/tool-cache';
import path from 'path';
import os from 'os';
/**
* Get the path to the `expo-cli` from cache, if any.
* Note, this cache is **NOT** shared between jobs.
*
* @see https://github.com/actions/toolkit/issues/47
*/
export async function fromLocalCache(version: string) {
return toolCache.find('expo-cli', version, os.arch());
}
/**
* Store the root of `expo-cli` in the cache, for future reuse.
* Note, this cache is **NOT** shared between jobs.
*
* @see https://github.com/actions/toolkit/issues/47
*/
export async function toLocalCache(root: string, version: string) {
return toolCache.cacheDir(root, 'expo-cli', version, os.arch());
}
/**
* Download the remotely stored `expo-cli` from cache, if any.
* Note, this cache is shared between jobs.
*/
export async function fromRemoteCache(version: string, packager: string, customCacheKey?: string) {
// see: https://github.com/actions/toolkit/blob/8a4134761f09d0d97fb15f297705fd8644fef920/packages/tool-cache/src/tool-cache.ts#L401
const target = path.join(process.env['RUNNER_TOOL_CACHE'] || '', 'expo-cli', version, os.arch());
const cacheKey = customCacheKey || getRemoteKey(version, packager);
try {
const hit = await restoreCache(target, cacheKey, cacheKey);
if (hit) {
return target;
}
} catch (error) {
core.setFailed(error.message);
}
}
/**
* Store the root of `expo-cli` in the remote cache, for future reuse.
* Note, this cache is shared between jobs.
*/
export async function toRemoteCache(source: string, version: string, packager: string, customCacheKey?: string) {
const cacheKey = customCacheKey || getRemoteKey(version, packager);
try {
await saveCache(source, cacheKey);
} catch (error) {
core.setFailed(error.message);
}
}
/**
* Get the cache key to use when (re)storing the Expo CLI from remote cache.
*/
function getRemoteKey(version: string, packager: string) {
return `expo-cli-${process.platform}-${os.arch()}-${packager}-${version}`;
}
+25
View File
@@ -0,0 +1,25 @@
import * as core from '@actions/core';
import * as cli from '@actions/exec';
/**
* Authenticate at Expo using `expo login`.
* This step is required for publishing and building new apps.
* It uses the `EXPO_CLI_PASSWORD` environment variable for improved security.
*/
export async function authenticate(username: string, password: string) {
if (!username || !password) {
return core.info('Skipping authentication, `expo-username` and/or `expo-password` not set...');
}
// github actions toolkit will handle commands with `.cmd` on windows, we need that
const bin = process.platform === 'win32'
? 'expo.cmd'
: 'expo';
await cli.exec(bin, ['login', `--username=${username}`], {
env: {
...process.env,
EXPO_CLI_PASSWORD: password,
},
});
}
+3
View File
@@ -0,0 +1,3 @@
import { run } from './run';
run();
+70
View File
@@ -0,0 +1,70 @@
import * as core from '@actions/core';
import * as cli from '@actions/exec';
import * as io from '@actions/io';
import * as path from 'path';
import {
fromLocalCache,
fromRemoteCache,
toLocalCache,
toRemoteCache,
} from './cache';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const registry = require('libnpm');
interface InstallConfig {
version: string;
packager: string;
cache?: boolean;
cacheKey?: string;
}
/**
* Resolve the provided semver to exact version of `expo-cli`.
* This uses the npm registry and accepts latest, dist-tags or version ranges.
* It's used to determine the cached version of `expo-cli`.
*/
export async function resolve(version: string) {
return (await registry.manifest(`expo-cli@${version}`)).version;
}
/**
* Install `expo-cli`, by version, using the packager.
* Here you can provide any semver range or dist tag used in the registry.
* It returns the path where Expo is installed.
*/
export async function install(config: InstallConfig) {
const exact = await resolve(config.version);
let root: string | undefined = await fromLocalCache(exact);
if (!root && config.cache) {
root = await fromRemoteCache(exact, config.packager, config.cacheKey);
} else {
core.info('Skipping remote cache, not enabled...');
}
if (!root) {
root = await fromPackager(exact, config.packager)
root = await toLocalCache(root, exact);
if (config.cache) {
await toRemoteCache(root, exact, config.packager, config.cacheKey);
}
}
return path.join(root, 'node_modules', '.bin');
}
/**
* Install `expo-cli`, by version, using npm or yarn.
* It creates a temporary directory to store all required files.
*/
export async function fromPackager(version: string, packager: string) {
const root = process.env['RUNNER_TEMP'] || '';
const tool = await io.which(packager);
await io.mkdirP(root);
await cli.exec(tool, ['add', `expo-cli@${version}`], { cwd: root });
return root;
}
+26
View File
@@ -0,0 +1,26 @@
import { addPath, getInput } from '@actions/core';
import { authenticate } from './expo';
import { install } from './install';
import { patchWatchers } from './system';
export async function run() {
const path = await install({
version: getInput('expo-version') || 'latest',
packager: getInput('expo-packager') || 'yarn',
cache: (getInput('expo-cache') || 'false') === 'true',
cacheKey: getInput('expo-cache-key') || undefined,
});
addPath(path);
await authenticate(
getInput('expo-username'),
getInput('expo-password'),
);
const shouldPatchWatchers = getInput('expo-patch-watchers') || 'true';
if (shouldPatchWatchers !== 'false') {
await patchWatchers();
}
}
+28
View File
@@ -0,0 +1,28 @@
import * as core from '@actions/core';
import * as cli from '@actions/exec';
/**
* Try to patch the default watcher/inotify limit.
* This is a limitation from GitHub Actions and might be an issue in some Expo projects.
* It sets the system's `fs.inotify` limits to a more sensible setting.
*
* @see https://github.com/expo/expo-github-action/issues/20
*/
export async function patchWatchers() {
if (process.platform !== 'linux') {
return core.info('Skipping patch for watchers, not running on Linux...');
}
core.info('Patching system watchers for the `ENOSPC` error...');
try {
// see https://github.com/expo/expo-cli/issues/277#issuecomment-452685177
await cli.exec('sudo sysctl fs.inotify.max_user_instances=524288');
await cli.exec('sudo sysctl fs.inotify.max_user_watches=524288');
await cli.exec('sudo sysctl fs.inotify.max_queued_events=524288');
await cli.exec('sudo sysctl -p');
} catch {
core.warning('Looks like we can\'t patch watchers/inotify limits, you might encouter the `ENOSPC` error.');
core.warning('For more info, https://github.com/expo/expo-github-action/issues/20');
}
}
+45
View File
@@ -0,0 +1,45 @@
import * as core from '@actions/core';
import * as cli from '@actions/exec';
import * as expo from '../src/expo';
import { setPlatform, resetPlatform } from './utils';
describe('authenticate', () => {
const spy = {
exec: jest.spyOn(cli, 'exec').mockImplementation(),
info: jest.spyOn(core, 'info').mockImplementation(),
};
it('skips authentication without credentials', async () => {
await expo.authenticate('', '');
expect(spy.exec).not.toBeCalled();
expect(spy.info).toBeCalled();
});
it('skips authentication without password', async () => {
await expo.authenticate('bycedric', '');
expect(spy.exec).not.toBeCalled();
expect(spy.info).toBeCalled();
});
it('executes login command with password through environment', async () => {
process.env['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: {
TEST_INCLUDED: 'hellyeah',
EXPO_CLI_PASSWORD: 'mypassword',
},
});
});
it('executes login command with `.cmd` suffix on windows', async () => {
setPlatform('win32');
await expo.authenticate('bycedric', 'mypassword');
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][0]).toBe('expo.cmd');
resetPlatform();
});
});
+85
View File
@@ -0,0 +1,85 @@
const cli = { exec: jest.fn() };
const io = { mkdirP: jest.fn(), which: jest.fn() };
const registry = { manifest: jest.fn() };
const cache = {
fromLocalCache: jest.fn(),
fromRemoteCache: jest.fn(),
toLocalCache: jest.fn(),
toRemoteCache: jest.fn(),
};
jest.mock('@actions/exec', () => cli);
jest.mock('@actions/io', () => io);
jest.mock('libnpm', () => registry);
jest.mock('../src/cache', () => cache);
import * as install from '../src/install';
describe('resolve', () => {
it('fetches exact version of expo-cli', async () => {
registry.manifest.mockResolvedValue({ version: '3.0.10' });
expect(await install.resolve('latest')).toBe('3.0.10');
expect(registry.manifest).toBeCalledWith('expo-cli@latest');
});
});
describe('install', () => {
it('installs path from cache', async () => {
cache.fromLocalCache.mockResolvedValue('/cache/path');
const expoPath = await install.install({ version: '3.0.10', packager: 'npm' });
expect(expoPath).toBe('/cache/path/node_modules/.bin');
});
it('installs path from packager and cache it', async () => {
process.env['RUNNER_TEMP'] = '/temp/path';
cache.fromLocalCache.mockResolvedValue(undefined);
cache.toLocalCache.mockResolvedValue('/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');
});
});
describe('fromPackager', () => {
it('resolves tool path', async () => {
await install.fromPackager('3.0.10', 'npm');
expect(io.which).toBeCalledWith('npm');
});
it('creates temporary folder', async () => {
process.env['RUNNER_TEMP'] = '/temp/path';
await install.fromPackager('latest', 'yarn');
expect(io.mkdirP).toBeCalledWith('/temp/path');
});
it('installs expo with tool', async () => {
process.env['RUNNER_TEMP'] = '/temp/path';
io.which.mockResolvedValue('npm');
const expoPath = await install.fromPackager('beta', 'npm');
expect(expoPath).toBe('/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' });
});
});
// todo: move this to cache tests
// describe('fromCache', () => {
// it('uses cache for exact version', async () => {
// toolCache.find.mockResolvedValue('/cache/expo/path');
// const cachePath = await install.fromCache('3.0.10');
// expect(toolCache.find).toBeCalledWith('expo-cli', '3.0.10');
// expect(cachePath).toBe('/cache/expo/path');
// });
// });
// describe('toCache', () => {
// it('uses cache for installed folder', async () => {
// toolCache.cacheDir.mockResolvedValue('/cache/expo/path');
// const cachePath = await install.toCache('3.0.10', '/expo/install/path');
// expect(toolCache.cacheDir).toBeCalledWith('/expo/install/path', 'expo-cli', '3.0.10');
// expect(cachePath).toBe('/cache/expo/path');
// });
// });
+85
View File
@@ -0,0 +1,85 @@
const core = { addPath: jest.fn(), getInput: jest.fn() };
const exec = { exec: jest.fn() };
const expo = { authenticate: jest.fn() };
const install = { install: jest.fn() };
const system = { patchWatchers: jest.fn() };
jest.mock('@actions/core', () => core);
jest.mock('@actions/exec', () => exec);
jest.mock('../src/expo', () => expo);
jest.mock('../src/install', () => install);
jest.mock('../src/system', () => system);
import { run } from '../src/run';
interface MockInputProps {
version?: string;
packager?: string;
username?: string;
password?: string;
patchWatchers?: string;
cache?: string;
cacheKey?: string;
}
const mockInput = (props: MockInputProps = {}) => {
// fix: kind of dirty workaround for missing "mock 'value' based on arguments"
const input = (name: string) => {
switch (name) {
case 'expo-version': return props.version || '';
case 'expo-packager': return props.packager || '';
case 'expo-username': return props.username || '';
case 'expo-password': return props.password || '';
case 'expo-patch-watchers': return props.patchWatchers || '';
case 'expo-cache': return props.cache || '';
case 'expo-cache-key': return props.cacheKey || '';
default: return '';
}
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
core.getInput = input as any;
};
describe('run', () => {
it('installs latest expo-cli with yarn by default', async () => {
await run();
expect(install.install).toBeCalledWith({ version: 'latest', packager: 'yarn', cache: false });
});
it('installs provided version expo-cli with npm', async () => {
mockInput({ version: '3.0.10', packager: 'npm' });
await run();
expect(install.install).toBeCalledWith({ version: '3.0.10', packager: 'npm', cache: false });
});
it('installs path to global path', async () => {
install.install.mockResolvedValue('/expo/install/path');
await run();
expect(core.addPath).toBeCalledWith('/expo/install/path');
});
it('patches the system when set to true', async () => {
mockInput({ patchWatchers: 'true' });
await run();
expect(system.patchWatchers).toHaveBeenCalled();
});
it('patches the system when not set', async () => {
mockInput({ patchWatchers: '' });
await run();
expect(system.patchWatchers).toHaveBeenCalled();
});
it('skips the system patch when set to false', async () => {
mockInput({ patchWatchers: 'false' });
await run();
expect(system.patchWatchers).not.toHaveBeenCalled();
});
it('authenticates with provided credentials', async () => {
mockInput({ username: 'bycedric', password: 'mypassword', patchWatchers: 'false' });
await run();
expect(expo.authenticate).toBeCalledWith('bycedric', 'mypassword');
});
});
+57
View File
@@ -0,0 +1,57 @@
import * as core from '@actions/core';
import * as cli from '@actions/exec';
import * as system from '../src/system';
import { setPlatform, resetPlatform } from './utils';
describe('patchWatchers', () => {
const spy = {
info: jest.spyOn(core, 'info').mockImplementation(),
warning: jest.spyOn(core, 'warning').mockImplementation(),
exec: jest.spyOn(cli, 'exec').mockImplementation(),
};
afterEach(() => {
resetPlatform();
});
it('increses fs inotify settings with sysctl', async () => {
setPlatform('linux');
await system.patchWatchers();
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_instances=524288');
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_watches=524288');
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_queued_events=524288');
expect(spy.exec).toBeCalledWith('sudo sysctl -p');
});
it('warns for unsuccessful patches', async () => {
const error = new Error('Something went wrong');
spy.exec.mockRejectedValueOnce(error);
setPlatform('linux');
await system.patchWatchers();
expect(core.warning).toBeCalledWith(expect.stringContaining('can\'t patch watchers'));
expect(core.warning).toBeCalledWith(
expect.stringContaining('https://github.com/expo/expo-github-action/issues/20')
);
});
it('skips on windows platform', async () => {
setPlatform('win32');
await system.patchWatchers();
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping'));
expect(spy.exec).not.toHaveBeenCalled();
});
it('skips on macos platform', async () => {
setPlatform('darwin');
await system.patchWatchers();
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping'));
expect(spy.exec).not.toHaveBeenCalled();
});
it('runs on linux platform', async () => {
setPlatform('linux');
await system.patchWatchers();
expect(spy.info).toBeCalledWith(expect.stringContaining('Patching'));
expect(spy.exec).toHaveBeenCalled();
});
});
+17
View File
@@ -0,0 +1,17 @@
// keep track of the original one to revert the platform
const originalPlatform = process.platform;
/**
* Change the node platform for testing purposes.
* With this you can fake the `process.platform`.
*/
export function setPlatform(platform: NodeJS.Platform) {
Object.defineProperty(process, 'platform', { value: platform });
}
/**
* Revert the platform to the original one.
*/
export function resetPlatform() {
setPlatform(originalPlatform);
}
+18
View File
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": [
"es6"
],
"outDir": "./build",
"rootDir": "./src",
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true
},
"exclude": [
"node_modules",
"tests/**"
]
}