Revert "wip" #40
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: Build and Upload JARs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
release_name: snapshot-linux | |
- os: windows-2019 | |
release_name: snapshot-windows | |
- os: macos-14 | |
release_name: snapshot-macos | |
- os: macos-12 | |
release_name: snapshot-macos-intel | |
env: | |
SCALA_VERSION: '3.5.1-RC2' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Pick and display a JDK version and distribution | |
id: pick-jdk | |
run: | | |
JDK_VERSION=8 | |
if [[ "$RUNNER_OS" == "macOS" && "$RUNNER_ARCH" == "ARM64" ]]; then | |
JDK_VERSION=11 | |
fi | |
JDK_DISTRIBUTION=temurin | |
echo "JDK_VERSION=$JDK_VERSION" >> $GITHUB_ENV | |
echo "JDK_DISTRIBUTION=$JDK_DISTRIBUTION" >> $GITHUB_ENV | |
shell: bash | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JDK_DISTRIBUTION }} | |
java-version: ${{ env.JDK_VERSION }} | |
cache: sbt | |
- uses: sbt/setup-sbt@v1 | |
- name: Cache SBT (Unix) | |
if: runner.os != 'Windows' | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.ivy2/cache | |
~/.sbt | |
~/.coursier | |
~/.cache/coursier | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }} | |
restore-keys: | | |
${{ runner.os }}-sbt- | |
- name: Cache SBT for Windows | |
if: runner.os == 'Windows' | |
uses: actions/cache@v4 | |
with: | |
path: | | |
C:\Users\runneradmin\.ivy2\cache | |
C:\Users\runneradmin\.sbt | |
C:\Users\runneradmin\.coursier | |
C:\Users\runneradmin\AppData\Local\Coursier\cache | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }} | |
restore-keys: | | |
${{ runner.os }}-sbt- | |
- name: SBT Clean | |
working-directory: chester-in-scala | |
run: sbt clean | |
shell: bash | |
# for some reason clean calls stImport and stImport usually fails at first run | |
continue-on-error: true | |
# maybe test will fail on the first try because of stImport, the typescript to scala thing. | |
- name: Run Tests | |
working-directory: chester-in-scala | |
run: sbt test || sbt test | |
shell: bash | |
- name: Build Common JAR with SBT | |
working-directory: chester-in-scala | |
run: sbt common/assembly | |
shell: bash | |
- name: Build CLI JAR with SBT | |
working-directory: chester-in-scala | |
run: sbt cli/assembly | |
shell: bash | |
- name: Build LSP JAR with SBT | |
working-directory: chester-in-scala | |
run: sbt lsp/assembly | |
shell: bash | |
- name: Build Native Image for CLI | |
working-directory: chester-in-scala | |
run: sbt cli/nativeImage | |
shell: bash | |
- name: Build CLI Native Executable | |
working-directory: chester-in-scala | |
run: sbt cliNative/nativeLink | |
shell: bash | |
- name: Rename CLI Native Executable | |
working-directory: chester-in-scala | |
run: | | |
if [[ "$RUNNER_OS" == "Windows" ]]; then | |
mv cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-cli-out.exe cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe || mv cli/native/target/scala-${{ env.SCALA_VERSION }}/native/chester.cli.Main.exe cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe | |
else | |
mv cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-cli-out cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out || mv cli/native/target/scala-${{ env.SCALA_VERSION }}/native/chester.cli.Main cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out | |
fi | |
shell: bash | |
- name: Test Native Image for CLI integrity | |
working-directory: chester-in-scala | |
run: ./target/chester integrity | |
shell: bash | |
- name: Build Native Image for LSP | |
working-directory: chester-in-scala | |
run: sbt lsp/nativeImage | |
shell: bash | |
- name: Generate JS Artifacts | |
working-directory: chester-in-scala | |
run: | | |
sbt cliJS/fullLinkJS | |
mv cli/js/target/scala-${{ env.SCALA_VERSION }}/chester-cli-opt/main.js cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js | |
shell: bash | |
- name: List files for debugging | |
run: find chester-in-scala -type f -name "*.jar" -or -name "chester" -or -name "chester-lsp" -or -name "chester-out" -or -name "*.exe" | |
shell: bash | |
continue-on-error: true | |
- name: Upload Unix Artifacts | |
if: runner.os != 'Windows' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.release_name }} | |
path: | | |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar | |
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar | |
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar | |
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js | |
chester-in-scala/target/chester | |
chester-in-scala/target/chester-lsp | |
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out | |
- name: Upload Windows Artifacts | |
if: runner.os == 'Windows' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.release_name }} | |
path: | | |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar | |
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar | |
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar | |
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js | |
chester-in-scala/target/chester.exe | |
chester-in-scala/target/chester-lsp.exe | |
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe | |
- name: Create or Update GitHub Release for Unix | |
if: runner.os != 'Windows' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ matrix.release_name }} | |
name: ${{ matrix.release_name }} | |
allowUpdates: true | |
prerelease: true | |
artifacts: | | |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar, | |
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar, | |
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar, | |
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js, | |
chester-in-scala/target/chester, | |
chester-in-scala/target/chester-lsp, | |
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out | |
- name: Create or Update GitHub Release for Windows | |
if: runner.os == 'Windows' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ matrix.release_name }} | |
name: ${{ matrix.release_name }} | |
allowUpdates: true | |
prerelease: true | |
artifacts: | | |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar, | |
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar, | |
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar, | |
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js, | |
chester-in-scala/target/chester.exe, | |
chester-in-scala/target/chester-lsp.exe, | |
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe |