enso/.github/workflows/scala.yml

424 lines
15 KiB
YAML
Raw Normal View History

name: Engine CI
2020-03-24 15:52:02 +03:00
on:
push:
2020-07-21 15:59:40 +03:00
branches: [main, "release/*"]
2020-03-24 15:52:02 +03:00
pull_request:
2020-07-21 15:59:40 +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-08-28 14:03:09 +03:00
graalVersion: 20.2.0
2020-07-10 13:57:42 +03:00
# Please ensure that this is in sync with javaVersion in build.sbt
javaVersion: 11
2020-03-24 15:52:02 +03:00
# Please ensure that this is in sync with project/build.properties
sbtVersion: 1.3.13
2020-08-07 12:18:09 +03:00
# Please ensure that this is in sync with rustVersion in build.sbt
rustToolchain: nightly-2019-11-04
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 }}
timeout-minutes: 45
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: Enable Developer Command Prompt (Windows)
uses: ilammy/msvc-dev-cmd@v1.3.0
- name: Disable TCP/UDP Offloading (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
2020-09-07 14:24:34 +03:00
- name: Disable TCP/UDP Offloading (Linux)
if: runner.os == 'Linux'
shell: bash
run: sudo ethtool -K eth0 tx off rx off
- name: Disable TCP/UDP Offloading (Windows)
if: runner.os == 'Windows'
shell: powershell
run: >
Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6
-UdpIPv6
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rustToolchain }}
override: true
2020-05-15 11:07:58 +03:00
- 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: ayltai/setup-graalvm@v1
2020-05-15 11:07:58 +03:00
with:
graalvm-version: ${{ env.graalVersion }}
java-version: ${{ env.javaVersion }}
native-image: true
2020-05-15 11:07:58 +03:00
- name: Set Up SBT
run: |
curl --retry 4 --retry-connrefused -fsSL -o sbt.tgz https://github.com/sbt/sbt/releases/download/v${{env.sbtVersion}}/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: |
sleep 1
sbt --no-colors bootstrap
2020-05-15 11:07:58 +03:00
- name: Build Enso
run: |
sleep 1
sbt --no-colors compile
2020-04-10 22:24:37 +03:00
2020-05-15 11:07:58 +03:00
# Tests
2020-07-14 14:44:40 +03:00
- name: Setup Tests on Windows
if: runner.os == 'Windows'
run: |
echo '::set-env name=CI_TEST_TIMEFACTOR::2'
echo '::set-env name=CI_TEST_FLAKY_ENABLE::true'
2020-08-28 14:03:09 +03:00
- name: Build the Launcher
run: |
sleep 1
sbt --no-colors launcher/buildNativeImage
echo '::set-env name=LAUNCHER_NATIVE_IMAGE_TEST_SKIP_BUILD::true'
2020-05-15 11:07:58 +03:00
- name: Test Enso
run: |
sleep 1
sbt --no-colors "set Global / parallelExecution := false; test"
2020-05-15 11:07:58 +03:00
- name: Check Runtime Benchmark Compilation
run: |
sleep 1
sbt --no-colors runtime/Benchmark/compile
2020-07-01 14:21:13 +03:00
- name: Check Language Server Benchmark Compilation
run: |
sleep 1
sbt --no-colors language-server/Benchmark/compile
2020-07-06 16:55:21 +03:00
- name: Check Searcher Benchmark Compilation
run: |
sleep 1
sbt --no-colors searcher/Benchmark/compile
2020-05-15 11:07:58 +03:00
- name: Build the Uberjar
run: |
sleep 1
sbt --no-colors runner/assembly
2020-05-15 11:07:58 +03:00
- name: Test the Uberjar
run: ./runner.jar --run tools/ci/Test.enso
- name: Test the Repl in the Uberjar
shell: bash
2020-07-21 15:59:40 +03:00
run:
cat tools/ci/artifact-test/repl/ReplTest.in | ./runner.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-08-07 12:18:09 +03:00
runs-on: ${{ matrix.os }}
timeout-minutes: 45
2020-08-07 12:18:09 +03:00
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
fail-fast: false
2020-03-24 22:35:42 +03:00
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'
2020-09-07 14:24:34 +03:00
- name: Enable Developer Command Prompt (Windows)
uses: ilammy/msvc-dev-cmd@v1.3.0
- name: Disable TCP/UDP Offloading (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
2020-09-07 14:24:34 +03:00
- name: Disable TCP/UDP Offloading (Linux)
if: runner.os == 'Linux'
shell: bash
run: sudo ethtool -K eth0 tx off rx off
- name: Disable TCP/UDP Offloading (Windows)
if: runner.os == 'Windows'
shell: powershell
run: >
Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6
-UdpIPv6
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rustToolchain }}
override: true
2020-05-15 11:07:58 +03:00
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
conda-channels: anaconda, conda-forge
2020-08-07 12:18:09 +03:00
- 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
2020-05-15 11:07:58 +03:00
- name: Install FlatBuffers Compiler
run: conda install flatbuffers=1.12.0
- name: Setup GraalVM Environment
uses: ayltai/setup-graalvm@v1
2020-05-15 11:07:58 +03:00
with:
graalvm-version: ${{ env.graalVersion }}
java-version: ${{ env.javaVersion }}
2020-08-07 12:18:09 +03:00
native-image: true
2020-05-15 11:07:58 +03:00
- name: Set Up SBT
run: |
curl --retry 4 --retry-connrefused -fsSL -o sbt.tgz https://github.com/sbt/sbt/releases/download/v${{env.sbtVersion}}/sbt-${{env.sbtVersion}}.tgz
2020-05-15 11:07:58 +03:00
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-08-07 12:18:09 +03:00
- name: Bootstrap the Project
run: |
sleep 1
sbt --no-colors bootstrap
- name: Build the Runtime Uberjar
run: |
sleep 1
sbt --no-colors runtime/assembly
- name: Build the Runner Uberjar
run: |
sleep 1
sbt --no-colors runner/assembly
- name: Build the Project Manager Uberjar
run: |
sleep 1
sbt --no-colors project-manager/assembly
2020-08-07 12:18:09 +03:00
- name: Build the Launcher Native Image
run: |
sleep 1
sbt --no-colors launcher/buildNativeImage
- name: Build the Manifest
run: |
cp distribution/manifest.template.yaml manifest.yaml
echo "graal-vm-version: $graalVersion" >> manifest.yaml
echo "graal-java-version: $javaVersion" >> manifest.yaml
2020-05-15 11:07:58 +03:00
- name: Build the Parser JS Bundle
2020-08-07 12:18:09 +03:00
# The builds are run on 3 platforms, but Flatbuffer schemas are platform
# agnostic, so they just need to be uploaded from one of the runners.
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
run: sbt -no-colors syntaxJS/fullOptJS
2020-08-07 12:18:09 +03:00
# Prepare distributions
# The version used in filenames is based on the version of the launcher.
# Currently launcher and engine versions are tied to each other so they
# can be used interchangeably like this. If in the future the versions
# become independent, this may require updating to use proper versions
# for each component.
2020-08-07 12:18:09 +03:00
- name: Prepare Distribution Version (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
DIST_VERSION=$(./enso version --json --only-launcher | jq -r '.version')
2020-08-07 12:18:09 +03:00
echo ::set-env name=DIST_VERSION::$DIST_VERSION
- name: Prepare Distribution Version (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
DIST_VERSION=$(./enso.exe version --json --only-launcher | jq -r '.version')
2020-08-07 12:18:09 +03:00
echo ::set-env name=DIST_VERSION::$DIST_VERSION
# Currently the only architecture supported by Github runners is amd64
- name: Prepare Distribution Environment
shell: bash
run: |
DIST_ARCH=amd64
DIST_OS=$(echo ${{ runner.os }} | awk '{print tolower($0)}')
LAUNCHER_DIST_ROOT=enso-launcher-$DIST_VERSION-$DIST_OS-$DIST_ARCH
LAUNCHER_DIST_DIR=$LAUNCHER_DIST_ROOT/enso
ENGINE_DIST_ROOT=enso-engine-$DIST_VERSION-$DIST_OS-$DIST_ARCH
ENGINE_DIST_DIR=$ENGINE_DIST_ROOT/enso-$DIST_VERSION
echo ::set-env name=LAUNCHER_DIST_DIR::$LAUNCHER_DIST_DIR
echo ::set-env name=LAUNCHER_DIST_ROOT::$LAUNCHER_DIST_ROOT
echo ::set-env name=ENGINE_DIST_DIR::$ENGINE_DIST_DIR
echo ::set-env name=ENGINE_DIST_ROOT::$ENGINE_DIST_ROOT
- name: Prepare Launcher Distribution (Common)
shell: bash
run: |
mkdir -p ${{ env.LAUNCHER_DIST_DIR }}
mkdir ${{ env.LAUNCHER_DIST_DIR }}/bin
mkdir ${{ env.LAUNCHER_DIST_DIR }}/dist
mkdir ${{ env.LAUNCHER_DIST_DIR }}/runtime
cp distribution/launcher/.enso.portable ${{ env.LAUNCHER_DIST_DIR }}
cp distribution/launcher/README.md ${{ env.LAUNCHER_DIST_DIR }}
cp distribution/launcher/NOTICE ${{ env.LAUNCHER_DIST_DIR }}
cp -r distribution/launcher/components-licences ${{ env.LAUNCHER_DIST_DIR }}
- name: Prepare Launcher Distribution (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
cp enso ${{ env.LAUNCHER_DIST_DIR }}/bin/
- name: Prepare Launcher Distribution (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cp enso.exe ${{ env.LAUNCHER_DIST_DIR }}/bin/
2020-09-30 14:33:57 +03:00
- name: Build Base Java Extensions
shell: bash
run: |
cd std-bits
mvn package
2020-08-07 12:18:09 +03:00
# 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.
# So the following two lines have been removed from this step, as they do
# nothing useful:
# chmod +x $ENGINE_DIST_DIR/bin/enso
# chmod +x $ENGINE_DIST_DIR/bin/project-manager
- name: Prepare Engine Distribution
shell: bash
run: |
mkdir -p $ENGINE_DIST_DIR
mkdir $ENGINE_DIST_DIR/component
cp runtime.jar $ENGINE_DIST_DIR/component
mv runner.jar $ENGINE_DIST_DIR/component
mv project-manager.jar $ENGINE_DIST_DIR/component
cp -r distribution/std-lib $ENGINE_DIST_DIR/std-lib
cp -r distribution/bin $ENGINE_DIST_DIR/bin
cp manifest.yaml $ENGINE_DIST_DIR
2020-05-15 11:07:58 +03:00
# Publish
2020-08-07 12:18:09 +03:00
- name: Publish the Engine Distribution Artifact
2020-05-15 11:07:58 +03:00
uses: actions/upload-artifact@v1.0.0
with:
2020-08-07 12:18:09 +03:00
name: ${{ env.ENGINE_DIST_ROOT }}
path: ${{ env.ENGINE_DIST_ROOT }}
- name: Publish the Launcher Binary
uses: actions/upload-artifact@v2
with:
name: ${{ env.LAUNCHER_DIST_ROOT }}
path: ${{ env.LAUNCHER_DIST_ROOT }}
2020-05-15 11:07:58 +03:00
- name: Prepare the FlatBuffers Schemas for Upload
2020-08-07 12:18:09 +03:00
# The builds are run on 3 platforms, but Flatbuffer schemas are platform
# agnostic, so they just need to be uploaded from one of the runners.
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
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
2020-08-07 12:18:09 +03:00
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
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
2020-08-07 12:18:09 +03:00
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
run: |
mkdir parser-upload
cp ./target/scala-parser.js parser-upload
- name: Publish the Parser JS Bundle
2020-08-07 12:18:09 +03:00
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
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
2020-08-07 12:18:09 +03:00
if: runner.os == 'Linux'
2020-07-10 13:57:42 +03:00
uses: actions/upload-artifact@v2
with:
name: manifest
path: manifest.yaml
2020-08-07 12:18:09 +03:00
# Publish FlatBuffer Schemas and Parser Bundle to S3
2020-05-15 11:07:58 +03:00
- name: Prepare AWS Session
2020-08-07 12:18:09 +03:00
shell: bash
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
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
2020-08-07 12:18:09 +03:00
shell: bash
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
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
2020-08-07 12:18:09 +03:00
shell: bash
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
run: |
aws s3 sync ./fbs-upload s3://packages-luna/fbs-schema/nightly/`git rev-parse HEAD` --profile s3-upload --acl public-read --delete
- name: Teardown AWS Session
2020-08-07 12:18:09 +03:00
shell: bash
if: runner.os == 'Linux'
2020-05-15 11:07:58 +03:00
run: |
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
null
null
null
text
EOF