enso/.github/workflows/scala.yml
2020-06-01 13:03:30 +01:00

231 lines
7.6 KiB
YAML

name: Enso CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# Please ensure that this is in sync with graalAPIVersion in build.sbt
graalVersion: 20.1.0
javaVersion: java8
# Please ensure that this is in sync with project/build.properties
sbtVersion: 1.3.12
excludedPaths: |
.github/PULL_REQUEST_TEMPLATE.md
.github/CODEOWNERS
.github/ISSUE_TEMPLATE/*
/doc/*
.gitignore
.scalafmt.conf
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
jobs:
# This job is responsible for testing the codebase
test:
name: Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: false
conda-channels: anaconda, conda-forge
- name: Setup Conda Environment on Windows
if: runner.os == 'Windows'
run: |
conda create --name enso
conda init powershell
- name: Activate Conda Environment on Windows
if: runner.os == 'Windows'
run: conda activate enso
- name: Install FlatBuffers Compiler
run: conda install --freeze-installed flatbuffers=1.12.0
- name: Setup GraalVM Environment
uses: DeLaGuardo/setup-graalvm@2.0
with:
graalvm-version: ${{ env.graalVersion }}.${{ env.javaVersion }}
- name: Set Up SBT
run: |
curl -fSL -o sbt.tgz https://piccolo.link/sbt-${{env.sbtVersion}}.tgz
tar -xzf sbt.tgz
echo ::add-path::$GITHUB_WORKSPACE/sbt/bin/
# Caches
- name: Cache Ivy
uses: actions/cache@v1.1.2
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-ivy-${{ hashFiles('**/build.sbt') }}
restore-keys: ${{ runner.os }}-ivy-
- name: Cache SBT
uses: actions/cache@v1.1.2
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('project/**') }}
restore-keys: ${{ runner.os }}-sbt-
- name: Cache Coursier and Mill
uses: actions/cache@v1.1.2
with:
path: ~/.cache
key: ${{ runner.os }}-coursier-${{ hashFiles('**build.sbt') }}
restore-keys: ${{ runner.os }}-coursier-
# Build
- name: Build Enso
run: sbt --no-colors compile
# Tests
- name: Test Enso
run: sbt --no-colors test
- name: Benchmark the Parser
run: sbt -no-colors syntax/bench
- name: Check Runtime Benchmark Compilation
run: sbt -no-colors runtime/Benchmark/compile
- name: Build the Uberjar
run: sbt -no-colors runner/assembly
- name: Test the Uberjar
run: ./enso.jar --run tools/ci/Test.enso
# This job is responsible for building the artifacts
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout (PR)
uses: actions/checkout@v2
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout (Branch)
uses: actions/checkout@v2
if: github.event_name != 'pull_request'
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
conda-channels: anaconda, conda-forge
- name: Install FlatBuffers Compiler
run: conda install flatbuffers=1.12.0
- name: Setup GraalVM Environment
uses: DeLaGuardo/setup-graalvm@2.0
with:
graalvm-version: ${{ env.graalVersion }}.${{ env.javaVersion }}
- name: Set Up SBT
run: |
curl -fSL -o sbt.tgz https://piccolo.link/sbt-${{env.sbtVersion}}.tgz
tar -xzf sbt.tgz
echo ::add-path::$GITHUB_WORKSPACE/sbt/bin/
# Caches
- name: Cache Ivy
uses: actions/cache@v1.1.2
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-ivy-${{ hashFiles('**/build.sbt') }}
restore-keys: ${{ runner.os }}-ivy-
- name: Cache SBT
uses: actions/cache@v1.1.2
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('project/**') }}
restore-keys: ${{ runner.os }}-sbt-
- name: Cache Coursier and Mill
uses: actions/cache@v1.1.2
with:
path: ~/.cache
key: ${{ runner.os }}-coursier-${{ hashFiles('**build.sbt') }}
restore-keys: ${{ runner.os }}-coursier-
# Build Artifacts
- name: Build the Uberjar
run: sbt --no-colors runner/assembly
- name: Prepare the CLI Artifact
run: |
CLI_DIR=enso-$(./enso.jar --version --json | jq -r '.version')
mkdir $CLI_DIR
mkdir $CLI_DIR/component
mv enso.jar $CLI_DIR/component
cp -r distribution/std-lib $CLI_DIR/std-lib
echo ::set-env name=CLI_DIR::$CLI_DIR
- name: Build the Parser JS Bundle
run: sbt -no-colors syntaxJS/fullOptJS
- name: Build the Project Manager Uberjar
run: |
sbt --no-colors runtime/assembly
sbt --no-colors project-manager/assembly
# Publish
- name: Publish the CLI Artifact
uses: actions/upload-artifact@v1.0.0
with:
name: ${{ env.CLI_DIR }}
path: ${{ env.CLI_DIR }}
- name: Prepare the FlatBuffers Schemas for Upload
run: |
mkdir fbs-upload
cp -r "engine/language-server/src/main/schema" fbs-upload/fbs-schema/
zip -r -m -ll "fbs-upload/fbs-schema.zip" "fbs-upload/fbs-schema/"
- name: Publish the FlatBuffers Schemas
uses: actions/upload-artifact@v1.0.0
with:
name: Engine Protocol FlatBuffers Schemas
path: ./fbs-upload/fbs-schema.zip
- name: Prepare Parser JS Bundle for Upload
run: |
mkdir parser-upload
cp ./target/scala-parser.js parser-upload
- name: Publish the Parser JS Bundle
uses: actions/upload-artifact@v1.0.0
with:
name: Parser JS Bundle
path: ./target/scala-parser.js
- name: Prepare the Project Manager package
run: |
mkdir pm-upload
cp ./runtime.jar pm-upload
cp ./project-manager.jar pm-upload
zip -r project-manager.zip ./runtime.jar ./project-manager.jar
- name: Publish the Project Manager package
uses: actions/upload-artifact@v1.0.0
with:
name: The Project Manager Bundle
path: ./project-manager.zip
- name: Prepare AWS Session
run: |
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
${{ secrets.PARSER_S3_ACCESS_KEY_ID }}
${{ secrets.PARSER_S3_SECRET_ACCESS_KEY }}
us-west-2
text
EOF
- name: Upload Parser JS Bundle to S3
run: |
aws s3 sync ./parser-upload s3://packages-luna/parser-js/nightly/`git rev-parse HEAD` --profile s3-upload --acl public-read --delete
- name: Upload FlatBuffers Schemas to S3
run: |
aws s3 sync ./fbs-upload s3://packages-luna/fbs-schema/nightly/`git rev-parse HEAD` --profile s3-upload --acl public-read --delete
- name: Upload Project Manager to S3
run: |
aws s3 sync ./pm-upload s3://packages-luna/project-manager/nightly/`git rev-parse HEAD` --profile s3-upload --acl public-read --delete
- name: Teardown AWS Session
run: |
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
null
null
null
text
EOF