Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mymindstorm committed May 23, 2020
1 parent 60bf1cb commit 740e359
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
26 changes: 7 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This actions step downloads emsdk and installs a version of Emscripten.

# Usage
## Usage

```yaml
name: "emsdk"
Expand All @@ -12,42 +12,30 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v4
- uses: mymindstorm/setup-emsdk@v5

- name: Verify
run: emcc -v
```
## Use with actions/cache
## Cache
```yaml
- name: Cache emsdk
uses: actions/cache@v4
id: cache # This is important!
with:
# Set to the same folder as actions-cache-folder (more below)
path: 'emsdk-cache'
# Set the end bit to emsdk version
key: ${{ runner.os }}-emsdk-1.38.40

- name: Setup emsdk (use cache if found, create otherwise)
uses: mymindstorm/setup-emsdk@v2
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v5
with:
# Make sure to set a version number!
version: 1.38.40
# This is the name of the cache folder.
# The cache folder will be placed in the build directory,
# so make sure it doesn't conflict with anything!
actions-cache-folder: 'emsdk-cache'
# This stops it from using tc.cacheDir since we are using
# actions/cache.
no-cache: true

- name: Verify
run: emcc -v
```
# Options
## Options
```yaml
version:
Expand All @@ -60,7 +48,7 @@ no-cache:
description: "If true will not cache any downloads with tc.cacheDir."
default: false
actions-cache-folder:
description: "Set to the folder where your cached emsdk-master folder is or where emsdk cache will be copied to on sucessful run. This folder will go under $GITHUB_HOME (I.e. build dir)."
description: "Directory to cache emsdk in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cahce."
default: ''
update-tags:
description: "Update tags before installing a version"
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
description: "If true will not cache any downloads with tc.cacheDir."
default: false
actions-cache-folder:
description: "Set to the folder where your cached emsdk-master folder is or where emsdk cache will be copied to on sucessful run. This folder will go under $GITHUB_HOME (I.e. build dir)."
description: "Directory to cache emsdk in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cahce."
default: ''
update-tags:
description: "Update tags before installing a version"
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function run() {
let emsdkFolder;
let foundInCache = false;

if (emArgs.version !== "latest" && emArgs.noCache === "false") {
if (emArgs.version !== "latest" && emArgs.noCache === "false" && !emArgs.actionsCacheFolder) {
emsdkFolder = await tc.find('emsdk', emArgs.version, os.arch());
}

Expand Down Expand Up @@ -68,7 +68,7 @@ async function run() {

await exec.exec(`${emsdk} install ${emArgs.version}`);

if (emArgs.version !== "latest" && emArgs.version !== "tot" && emArgs.noCache === "false") {
if (emArgs.version !== "latest" && emArgs.version !== "tot" && emArgs.noCache === "false" && !emArgs.actionsCacheFolder) {
await tc.cacheDir(emsdkFolder, 'emsdk', emArgs.version, os.arch());
}
}
Expand Down

0 comments on commit 740e359

Please sign in to comment.