enso/.github/workflows/scala.yml

337 lines
12 KiB
YAML
Raw Normal View History

name: Engine CI
2020-03-24 15:52:02 +03:00
on:
push:
branches: [ main, "release/*" ]
2020-03-24 15:52:02 +03:00
pull_request:
2020-06-12 17:51:59 +03:00
branches: [ "*" ]
2020-03-24 15:52:02 +03:00
env:
2020-07-10 13:57:42 +03:00
# Please ensure that this is in sync with graalVersion in build.sbt
2020-05-21 13:46:06 +03:00
graalVersion: 20.1.0
2020-07-10 13:57:42 +03:00
# Please ensure that this is in sync with javaVersion in build.sbt
2020-07-01 14:21:13 +03:00
javaVersion: java11
2020-03-24 15:52:02 +03:00
# Please ensure that this is in sync with project/build.properties
sbtVersion: 1.3.13
2020-04-10 22:24:37 +03:00
excludedPaths: |
.github/PULL_REQUEST_TEMPLATE.md
.github/CODEOWNERS
.github/ISSUE_TEMPLATE/*
/doc/*
.gitignore
.scalafmt.conf
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
2020-03-24 15:52:02 +03:00
jobs:
# This job is responsible for testing the codebase
2020-03-24 22:35:42 +03:00
test:
name: Test Engine
2020-03-24 15:52:02 +03:00
runs-on: ${{ matrix.os }}
2020-03-24 22:35:42 +03:00
timeout-minutes: 30
2020-03-24 15:52:02 +03:00
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
2020-03-24 15:52:02 +03:00
fail-fast: false
steps:
2020-05-15 11:07:58 +03:00
- 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 --retry 4 --retry-connrefused -fsSL -o sbt.tgz https://piccolo.link/sbt-${{env.sbtVersion}}.tgz
2020-05-15 11:07:58 +03:00
tar -xzf sbt.tgz
echo ::add-path::$GITHUB_WORKSPACE/sbt/bin/
2020-04-10 22:24:37 +03:00
2020-05-15 11:07:58 +03:00
# Caches
- name: Cache SBT
uses: actions/cache@v2
2020-05-15 11:07:58 +03:00
with:
path: |
~/.sbt
~/.ivy2/cache
~/.cache
key: ${{ runner.os }}-sbt-${{ hashFiles('**build.sbt') }}
2020-05-15 11:07:58 +03:00
restore-keys: ${{ runner.os }}-sbt-
2020-05-15 11:07:58 +03:00
# Build
2020-07-01 14:21:13 +03:00
- name: Bootstrap Enso project
run: sbt --no-colors bootstrap
2020-05-15 11:07:58 +03:00
- name: Build Enso
run: sbt --no-colors compile
2020-04-10 22:24:37 +03:00
2020-05-15 11:07:58 +03:00
# Tests
- name: Test Enso
run: sbt --no-colors test
- name: Check Runtime Benchmark Compilation
run: sbt -no-colors runtime/Benchmark/compile
2020-07-01 14:21:13 +03:00
- name: Check Language Server Benchmark Compilation
run: sbt -no-colors language-server/Benchmark/compile
2020-07-06 16:55:21 +03:00
- name: Check Searcher Benchmark Compilation
run: sbt -no-colors searcher/Benchmark/compile
2020-05-15 11:07:58 +03:00
- name: Build the Uberjar
run: sbt -no-colors runner/assembly
- name: Test the Uberjar
run: ./enso.jar --run tools/ci/Test.enso
- name: Test the Repl in the Uberjar
shell: bash
run: cat tools/ci/artifact-test/repl/ReplTest.in | ./enso.jar --repl | diff -q tools/ci/artifact-test/repl/ReplTest.out - && echo "Test successful"
2020-04-10 22:24:37 +03:00
# This job is responsible for building the artifacts
2020-04-10 22:24:37 +03:00
build:
name: Build Engine
2020-03-24 22:35:42 +03:00
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
2020-05-15 11:07:58 +03:00
- 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/
2020-05-15 11:07:58 +03:00
# Caches
- name: Cache SBT
uses: actions/cache@v2
2020-05-15 11:07:58 +03:00
with:
path: |
~/.sbt
~/.ivy2/cache
~/.cache
key: ${{ runner.os }}-sbt-${{ hashFiles('**build.sbt') }}
2020-05-15 11:07:58 +03:00
restore-keys: ${{ runner.os }}-sbt-
2020-04-10 22:24:37 +03:00
2020-05-15 11:07:58 +03:00
# Build Artifacts
2020-07-01 14:21:13 +03:00
- name: Bootstrap the project
run: sbt --no-colors bootstrap
- name: Build the Runtime Uberjar
run: sbt --no-colors runtime/assembly
- name: Build the Runner Uberjar
2020-05-15 11:07:58 +03:00
run: sbt --no-colors runner/assembly
- name: Build the Project Manager Uberjar
run: sbt --no-colors project-manager/assembly
- name: Prepare Distribution
2020-05-15 11:07:58 +03:00
run: |
2020-07-10 13:57:42 +03:00
DIST_VERSION=$(./enso.jar --version --json | jq -r '.version')
DIST_ROOT=enso-engine-$DIST_VERSION
DIST_DIR=$DIST_ROOT/enso-$DIST_VERSION
mkdir -p $DIST_DIR
mkdir $DIST_DIR/component
cp runtime.jar $DIST_DIR/component
mv enso.jar $DIST_DIR/component
mv project-manager.jar $DIST_DIR/component
cp -r distribution/std-lib $DIST_DIR/std-lib
cp -r distribution/bin $DIST_DIR/bin
chmod +x $DIST_DIR/bin/enso
chmod +x $DIST_DIR/bin/project-manager
2020-07-10 13:57:42 +03:00
echo ::set-env name=DIST_ROOT::$DIST_ROOT
echo ::set-env name=DIST_DIR::$DIST_DIR
2020-05-15 11:07:58 +03:00
- name: Build the Parser JS Bundle
run: sbt -no-colors syntaxJS/fullOptJS
2020-07-10 13:57:42 +03:00
- name: Build the Manifest
run: |
cp distribution/manifest.template.yml manifest.yml
echo "graal-vm-version: $graalVersion" >> manifest.yml
echo "graal-java-version: $javaVersion" >> manifest.yml
2020-05-15 11:07:58 +03:00
# Publish
- name: Publish the Distribution Artifact
2020-05-15 11:07:58 +03:00
uses: actions/upload-artifact@v1.0.0
with:
2020-07-10 13:57:42 +03:00
name: ${{ env.DIST_ROOT }}
path: ${{ env.DIST_ROOT }}
2020-05-15 11:07:58 +03:00
- 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
2020-07-10 13:57:42 +03:00
- name: Publish the Manifest
uses: actions/upload-artifact@v2
with:
name: manifest
path: manifest.yml
2020-05-15 11:07:58 +03:00
- name: Prepare AWS Session
run: |
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
2020-06-23 19:08:52 +03:00
${{ secrets.ARTEFACT_S3_ACCESS_KEY_ID }}
${{ secrets.ARTEFACT_S3_SECRET_ACCESS_KEY }}
2020-05-15 11:07:58 +03:00
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 Distribution to S3
2020-05-15 14:05:44 +03:00
run: |
aws s3 sync ${{ env.DIST_DIR }} s3://packages-luna/project-manager/nightly/`git rev-parse HEAD` --profile s3-upload --acl public-read --delete
2020-05-15 11:07:58 +03:00
- name: Teardown AWS Session
run: |
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
null
null
null
text
EOF
2020-07-10 13:57:42 +03:00
build-launcher:
name: Build Launcher
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
fail-fast: false
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: Enable Developer Command Prompt (Windows)
uses: ilammy/msvc-dev-cmd@v1.3.0
- name: Setup GraalVM Environment
uses: DeLaGuardo/setup-graalvm@2.0
with:
graalvm-version: ${{ env.graalVersion }}.${{ env.javaVersion }}
- name: Set Up Native Image (Windows)
if: runner.os == 'Windows'
run: gu.cmd -N install -n native-image
- name: Set Up Native Image (non-Windows)
if: runner.os != 'Windows'
run: gu -N install -n native-image
- 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 SBT
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.cache
key: ${{ runner.os }}-sbt-${{ hashFiles('**build.sbt') }}
restore-keys: ${{ runner.os }}-sbt-
# Build Artifacts
#- name: Bootstrap the project # As long as launcher doesn't depend on
# # runtime, bootstrap is not mandatory.
# run: sbt --no-colors bootstrap
- name: Build Launcher Native Image
run: sbt --no-colors launcher/buildNativeImage
# Publish
- name: Prepare distribution directory name (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
chmod +x enso
DIST_VERSION=$(./enso version --json | jq -r '.version')
DIST_ROOT=enso-launcher-$DIST_VERSION-$(echo ${{ runner.os }} | awk '{print tolower($0)}')-amd64
DIST_DIR=$DIST_ROOT/enso
echo ::set-env name=DIST_VERSION::$DIST_VERSION
echo ::set-env name=DIST_DIR::$DIST_DIR
echo ::set-env name=DIST_ROOT::$DIST_ROOT
- name: Prepare distribution directory name (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
DIST_VERSION=$(./enso.exe version --json | jq -r '.version')
DIST_ROOT=enso-launcher-$DIST_VERSION-$(echo ${{ runner.os }} | awk '{print tolower($0)}')-amd64
DIST_DIR=$DIST_ROOT/enso
echo ::set-env name=DIST_VERSION::$DIST_VERSION
echo ::set-env name=DIST_DIR::$DIST_DIR
echo ::set-env name=DIST_ROOT::$DIST_ROOT
- name: Prepare Launcher distribution (common)
shell: bash
run: |
mkdir -p ${{ env.DIST_DIR }}
mkdir ${{ env.DIST_DIR }}/bin
mkdir ${{ env.DIST_DIR }}/dist
mkdir ${{ env.DIST_DIR }}/jvm
cp distribution/launcher/README.md ${{ env.DIST_DIR }}
cp distribution/launcher/NOTICE ${{ env.DIST_DIR }}
cp -r distribution/launcher/components-licences ${{ env.DIST_DIR }}
- name: Prepare Launcher distribution (Unix)
if: runner.os != 'Windows'
run: |
cp enso ${{ env.DIST_DIR }}/bin/
- name: Prepare Launcher distribution (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cp enso.exe ${{ env.DIST_DIR }}/bin/
# The way artifacts are uploaded currently does not preserve the
# executable bits for Unix. However putting artifacts into a ZIP would
# create a twice nested ZIP file. For now, users downloading artifacts
# from the CI builds have to set the bit themselves.
- name: Publish the Launcher Binary
uses: actions/upload-artifact@v2
with:
name: ${{ env.DIST_ROOT }}
path: ${{ env.DIST_ROOT }}