Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Add Github Actions #4

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI

on:
push:
branches: [ dev, g_rescript ]
pull_request:
branches: [ dev, g_rescript ]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3
with:
path: ninja

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: "Windows: Use MSVC"
if: runner.os == 'Windows'
uses: TheMrMilchmann/setup-msvc-dev@v1
with:
arch: x64

- name: Run snapshot.js
run: |
node createBinDir.js
node snapshot.js
working-directory: ninja

- name: Get artifact info
id: get_artifact_info
run: node ninja/.github/workflows/get_artifact_info.js

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.get_artifact_info.outputs.artifact_name }}
path: ${{ steps.get_artifact_info.outputs.artifact_path }}
10 changes: 10 additions & 0 deletions .github/workflows/get_artifact_info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const artifactPath =
process.platform === "darwin"
? process.platform + process.arch
: process.platform;

const artifactName = "ninja-" + artifactPath;

// Pass artifactPath and artifactName to subsequent GitHub actions
console.log(`::set-output name=artifact_path::${artifactPath}`);
console.log(`::set-output name=artifact_name::${artifactName}`);
12 changes: 12 additions & 0 deletions createBinDir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Create bin dir for CI

const fs = require("fs");
const path = require("path");

const platform = process.platform;
const arch = process.arch;

const binDir = platform === "darwin" ? platform + arch : platform;
const binPath = path.join(__dirname, "..", binDir);

fs.mkdirSync(binPath);