Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action #3

Merged
merged 12 commits into from
Jul 15, 2024
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
- name: Build action
run: |
npm install
npm run lint
npm run build
git diff --exit-code
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ jobs:
with:
version: 1.23.0

- name: Check ISPC version
shell: pwsh
run: |
$output = & ispc --version | Out-String
if ($output -match "1.23.0") {
Write-Output "Expected version 1.23.0 found"
exit 0
} else {
Write-Output "Expected version 1.23.0, got $output"
exit 1
}

- name: ISPC version
run: |
ispc --version
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.swp
node_modules
ispc-releases
43 changes: 43 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Install Node.js

To develop and test the action, you need to install Node.js. To install
Node.js, use your OS package manager or follow the instruction on the
[Node.js website](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs).

# Install Dependencies
aneshlya marked this conversation as resolved.
Show resolved Hide resolved

```bash
npm install
```

# Lint Code

```bash
npm run lint-fix
```

# Bundle Action

```bash
npm run build
```

It is important to bundle the action before running it locally or pushing it to
the remote repository.

# Run Local Tests

To run the action locally, set the `RUNNER_TEMP` environment variable to a
temporary directory. Then use the run script to execute the action:

```bash
export RUNNER_TEMP=/tmp/runner_temp
npm run run
```

To provide input variables to the action, set the environment variables before
running the action:

```bash
INPUT_PLATFORM=macOS INPUT_VERSION=1.23.0 INPUT_ARCHITECTURE=x86_64 npm run run
```
75 changes: 73 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,73 @@
# install-ispc-action
Github Action to install ISPC compiler
[![Build status](https://github.com/ispc/install-ispc-action/actions/workflows/build.yml/badge.svg)](https://github.com/ispc/install-ispc-action/actions/workflows/build.yml)

# Install ISPC GitHub Action
aneshlya marked this conversation as resolved.
Show resolved Hide resolved

Github Action to install ISPC compiler.

## Input Variables

- `version`: Release version of `ispc` to install (optional).
- `platform`: Platform to download release of `ispc` for (optional); one of
`linux`, `windows` or `macOS`.
- `architecture`: Architecture to download release of `ispc` for (optional).

## Examples

### Quickstart

Single platform installation of latest ISPC release:

```yaml
on: push
jobs:
build:
runs-on: ubuntu-latest
name: build
steps:
- name: install ISPC
uses: ispc/install-ispc-action@main
```

To install specific version of ISPC, provide the `version` variable:

```yaml
on: push
jobs:
build:
runs-on: ubuntu-latest
name: build
steps:
- name: install ISPC
uses: ispc/install-ispc-action@main
with:
version: 1.22.0
```

### Platform Build Matrix

To install ISPC across platforms, add the `platform` variable to your build matrix:

```yaml
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux

- os: windows-latest
platform: windows

- os: macos-latest
platform: macOS

runs-on: ${{ matrix.os }}
name: build
steps:
- name: install ISPC
uses: ispc/install-ispc-action@main
with:
platform: ${{ matrix.platform }}
```
16 changes: 16 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Install ispc"
description: "Install Intel ispc."
author: "Indy Ray"
inputs:
version:
description: "Release version of ispc to install."
required: false
platform:
description: "Platform to download release of ispc for."
required: false
architecture:
description: "Architecture to download release of ispc for, on MacOS and Linux platforms."
required: false
runs:
using: 'node20'
main: 'build/main.cjs'
Loading