Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindberg committed Jun 17, 2022
1 parent 49db5d5 commit 6039453
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 253 deletions.
14 changes: 6 additions & 8 deletions .github/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/bin/bash
mkdir -p work/release
chmod 755 artifacts/linux-binary/bleep-linux
chmod 755 artifacts/macos-binary/bleep-macos

mv artifacts/linux-binary/bleep-linux "work/release/bleep-$VERSION-x86-64-pc-linux"
mv artifacts/macos-binary/bleep-macos "work/release/bleep-$VERSION-x86-64-apple-darwin"
mv artifacts/windows-binary/bleep-windows.exe artifacts/windows-binary/bleep.exe
mkdir -p work/release

mv artifacts/linux-binary/bleep "work/release/bleep-$VERSION-x86-64-pc-linux"
gzip "work/release/bleep-$VERSION-x86-64-pc-linux"

mv artifacts/macos-binary/bleep "work/release/bleep-$VERSION-x86-64-apple-darwin"
gzip "work/release/bleep-$VERSION-x86-64-apple-darwin"
CWD=$(pwd -P)
(cd artifacts/windows-binary && zip -r "$CWD/work/release/bleep-$VERSION-x86-64-pc-win32.zip" *.exe)

zip -rj "work/release/bleep-$VERSION-x86-64-pc-win32.zip" artifacts/windows-binary/bleep.exe
109 changes: 29 additions & 80 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,121 +15,70 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: graalvm/setup-graalvm@v1
- uses: coursier/setup-action@v1.2.0-M3
with:
version: '22.1.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: coursier/setup-action@v1
with:
apps: sbt
apps: scalafmt
- uses: coursier/cache-action@v6

- name: Scalafmt Check
if: ${{ matrix.os != 'windows-latest' }}
shell: bash
run: sbt --client scalafmtCheckAll
- name: "Test"
shell: bash
run: sbt --client "test"
- name: "Assembly"
shell: bash
run: sbt --client "bleep-cli/assembly"
- name: Temporarily save package
uses: actions/upload-artifact@v2
with:
name: java-binary
path: |
${{ github.workspace }}/bleep-cli/target/jvm-2.13/bleep-cli-assembly.jar
retention-days: 1
- name: Cleanup before cache
shell: bash
run: scalafmt -c .scalafmt.conf --check

- name: Install bleep stable
run: cs install --channel channel bleep --verbose

- name: Run tests
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
bleep generate-resources
bleep test
build-native-image:
name: Native image build on ${{ matrix.os }}
needs: [ build ]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
matrix:
include:
- os: ubuntu-latest
file_name: bleep-linux
file_name: bleep
artifact_name: linux-binary
- os: macos-latest
file_name: bleep-macos
file_name: bleep
artifact_name: macos-binary
- os: windows-latest
file_name: bleep-windows
file_name: bleep.exe
artifact_name: windows-binary
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Download application package
uses: actions/download-artifact@v2
with:
name: java-binary
- uses: graalvm/setup-graalvm@v1
with:
version: '22.1.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build native image on Linux
run: mkdir dist && native-image --enable-url-protocols=https -jar bleep-*.jar dist/${{ matrix.file_name }} && chmod 755 dist/${{ matrix.file_name }}
if: runner.os == 'Linux'

- name: Build native image on Mac OS X
run: mkdir dist && native-image --enable-url-protocols=https -jar bleep-*.jar dist/${{ matrix.file_name }} && chmod 755 dist/${{ matrix.file_name }}
if: runner.os == 'macOS'

- name: Build native image on Windows
run: >-
mkdir dist && "C:\Program Files (x86)\Microsoft Visual
Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && native-image --enable-url-protocols=https -jar bleep-*.jar dist/${{ matrix.file_name }}
if: runner.os == 'Windows'
- uses: coursier/[email protected]
- uses: coursier/cache-action@v6

- name: Test binary after build on Windows
shell: cmd
run: |
.\dist\${{ matrix.file_name }}.exe --ignore-version-in-build-file generate-resources
.\dist\${{ matrix.file_name }}.exe --ignore-version-in-build-file compile --no-color jvm213
if: runner.os == 'Windows'
- name: Install bleep stable
run: cs install --channel channel bleep --verbose

- name: Test binary after build on Linux
- name: Build native image
run: |
chmod 755 dist/${{ matrix.file_name }}
./dist/${{ matrix.file_name }} --ignore-version-in-build-file generate-resources
./dist/${{ matrix.file_name }} --ignore-version-in-build-file compile --no-color jvm213
if: runner.os == 'Linux'
bleep generate-resources
bleep native-image ${{ matrix.file_name }}
- name: Test binary after build on Macos
- name: Test binary after build
run: |
chmod 755 dist/${{ matrix.file_name }}
./dist/${{ matrix.file_name }} --ignore-version-in-build-file generate-resources
./dist/${{ matrix.file_name }} --ignore-version-in-build-file compile --no-color jvm213
if: runner.os == 'macOS'
${{ matrix.file_name }} --ignore-version-in-build-file generate-resources
${{ matrix.file_name }} --ignore-version-in-build-file test --no-color jvm213
- name: Temporarily save package
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_name }}
path: |
dist/bleep-*
${{ matrix.file_name }}
retention-days: 1

release:
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [ build-native-image ]
needs: [ build, build-native-image ]
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- uses: actions/checkout@v2
Expand All @@ -151,9 +100,9 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Release
run: |
chmod +x ./artifacts/linux-binary/bleep-linux
./artifacts/linux-binary/bleep-linux generate-resources
./artifacts/linux-binary/bleep-linux publish
chmod +x ./artifacts/linux-binary/bleep
./artifacts/linux-binary/bleep generate-resources
./artifacts/linux-binary/bleep publish
env:
CI_RELEASE: ${{ secrets.CI_RELEASE }}
CI_SNAPSHOT_RELEASE: ${{ secrets.CI_SNAPSHOT_RELEASE }}
Expand Down
139 changes: 0 additions & 139 deletions build.sbt

This file was deleted.

14 changes: 14 additions & 0 deletions channel/bleep.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"repositories": [
"central"
],
"dependencies": [
"build.bleep:bleep-core_3:latest.release"
],
"launcherType": "graalvm-native-image",
"prebuiltBinaries": {
"x86_64-pc-linux": "gz+https://github.com/oyvindberg/bleep/releases/download/v${version}/bleep-${version}-x86-64-pc-linux.gz",
"x86_64-pc-win32": "zip+https://github.com/oyvindberg/bleep/releases/download/v${version}/bleep-${version}-x86-64-pc-win32.zip",
"x86_64-apple-darwin": "gz+https://github.com/oyvindberg/bleep/releases/download/v${version}/bleep-${version}-x86-64-apple-darwin.gz"
}
}
1 change: 0 additions & 1 deletion project/build.properties

This file was deleted.

8 changes: 0 additions & 8 deletions project/plugins.sbt

This file was deleted.

43 changes: 26 additions & 17 deletions scripts/src/main/scala/bleep/scripts/GenNativeImage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@ package scripts

import bleep.tasks._

object GenNativeImage extends App {
bootstrap.forScript("GenNativeImage") { (started, commands) =>
val projectName = model.CrossProjectName(model.ProjectName("bleep-cli"), crossId = None)
val project = started.bloopProjects(projectName)
import java.nio.file.Path

commands.compile(List(projectName))
object GenNativeImage {
def main(args: Array[String]): Unit =
bootstrap.forScript("GenNativeImage") { (started, commands) =>
val projectName = model.CrossProjectName(model.ProjectName("bleep-cli"), crossId = None)
val project = started.bloopProjects(projectName)

val index = "https://raw.githubusercontent.com/coursier/jvm-index/master/index.json"
val plugin = new NativeImagePlugin(
project,
started.logger,
nativeImageOptions = List("--no-fallback", "-H:+ReportExceptionStackTraces"),
nativeImageJvm = "graalvm-java17",
nativeImageVersion = "22.1.0",
nativeImageJvmIndex = index
)
val path = plugin.nativeImage()
started.logger.info(s"Created native-image at $path")
}
commands.compile(List(projectName))

val index = "https://raw.githubusercontent.com/coursier/jvm-index/master/index.json"
val plugin = new NativeImagePlugin(
project,
started.logger,
nativeImageOptions = List("--no-fallback", "-H:+ReportExceptionStackTraces"),
nativeImageJvm = "graalvm-java17",
nativeImageVersion = "22.1.0",
nativeImageJvmIndex = index
) {
override def nativeImageOutput: Path =
args.headOption match {
case Some(value) => Path.of(value)
case None => super.nativeImageOutput
}
}
val path = plugin.nativeImage()
started.logger.info(s"Created native-image at $path")
}
}

0 comments on commit 6039453

Please sign in to comment.