wip #84
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
# Also allow running this workflow manually from the Actions tab. | |
workflow_dispatch: | |
jobs: | |
lingua-franca: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out reactor-ts repository | |
uses: actions/checkout@v3 | |
with: | |
path: "reactor-ts" | |
fetch-depth: 0 | |
- name: Check for PR Magic Reference, and set LF reference if one exists | |
uses: actions/github-script@v6 | |
if: ${{ github.event_name }} == "pull_request" | |
with: | |
script: | | |
function analyzeMagic(str) { | |
if (str == null) { | |
core.setOutput("hasMagic", "false"); | |
return; | |
} | |
; | |
const line = str.split("\n", 1)[0]; | |
console.log(line); | |
if (line.substring(0, 3) !== "!##" || !line.includes("=")) { | |
core.setOutput("hasMagic", "false"); | |
return; | |
} | |
const seperator = line.indexOf("="); | |
const directive = line.substring(3, seperator); | |
const value = line.substring(seperator + 1); | |
console.log(directive, value); | |
switch (directive) { | |
case "lf-ref": { | |
core.setOutput("hasMagic", "true"); | |
core.setOutput("lf-ref", value); | |
break; | |
} | |
default: { | |
console.log(`Invalid directive ${directive}`); | |
core.setOutput("hasMagic", "false"); | |
} | |
} | |
} | |
analyzeMagic(context.payload.pull_request.body); | |
- name: Read lingua-franca-ref.txt | |
run: echo "lingua-franca-ref=$(cat ./reactor-ts/lingua-franca-ref.txt)" >> $GITHUB_ENV | |
- name: Check out lingua-franca repository | |
uses: actions/checkout@v3 | |
with: | |
repository: lf-lang/lingua-franca | |
ref: ${{ env.lingua-franca-ref }} | |
fetch-depth: 0 | |
path: "lingua-franca" | |
submodules: true | |
- name: Move Lingua Franca to default pwd | |
run: | | |
shopt -s dotglob | |
mv -- ./lingua-franca/* ${{ github.workspace }} | |
shopt -u dotglob | |
- name: Prepare build environment | |
uses: ./.github/actions/prepare-build-env | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: 'reactor-ts/package-lock.json' | |
- name: Build reactor-ts | |
run: | | |
cd ./reactor-ts | |
npm install | |
npm run build | |
- name: Install pnpm | |
run: npm i -g pnpm |