diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..716f0dcd64 --- /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);