From 24cc09f62a43a26eb45245c633c6a63a82687c1e Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Thu, 26 May 2022 07:01:19 +0200 Subject: [PATCH 1/2] Add CI --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++ .github/workflows/get_artifact_info.js | 10 ++++++ createBinDir.js | 12 +++++++ 3 files changed, 70 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/get_artifact_info.js create mode 100644 createBinDir.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..15efa5ab57 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.github/workflows/get_artifact_info.js b/.github/workflows/get_artifact_info.js new file mode 100644 index 0000000000..a10d010642 --- /dev/null +++ b/.github/workflows/get_artifact_info.js @@ -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}`); diff --git a/createBinDir.js b/createBinDir.js new file mode 100644 index 0000000000..4f9f40919d --- /dev/null +++ b/createBinDir.js @@ -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); From 957ad909317a666849a7cc38ef0f7472bcf2839c Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 26 May 2022 09:09:50 +0200 Subject: [PATCH 2/2] see if actions run --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15efa5ab57..716f0dcd64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: CI on: push: