Skip to content
This repository has been archived by the owner on Jun 1, 2020. It is now read-only.

Commit

Permalink
initial test of new gh actions beta
Browse files Browse the repository at this point in the history
building for macos/linux, but not releasing yet. fair amount of ugly and
or duplicative code due to lack of templating features from Azure.
  • Loading branch information
mroth committed Aug 28, 2019
1 parent 18dc27f commit 8231885
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 0 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Build
on: [push]

# this format from Azure doesnt seem to be supported yet.
# TODO: find these hardcoded values and eliminate with GHA version
# variables:
# scalafmt_version: v2.0.1
# graalvm_version: '19.1.1'

jobs:
# Initial task to compile a JAR, store as a pipeline artifact to be used by
# downstream builders.
build-jar:
runs-on: ubuntu-18.04
steps:
- name: Install SBT
run: |
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
- name: Build scalafmt with assembly into JAR
env:
SCALAFMT_VERSION: v2.0.1
run: |
git clone https://github.com/scalameta/scalafmt --branch ${SCALAFMT_VERSION} --depth 1
cd scalafmt
sbt cli/assembly
- uses: actions/upload-artifact@v1
with:
path: scalafmt/scalafmt-cli/target/scala-2.12/scalafmt.jar
name: jar

native-image-linux:
needs: [build-jar]
runs-on: ubuntu-18.04
container:
image: oracle/graalvm-ce:19.1.1
steps:
- name: install native-image
run: gu install native-image
- uses: actions/download-artifact@v1
with:
name: jar
path: .
- run: ls -lh
- name: build Linux native image (static)
run: |
native-image \
--static \
--no-fallback \
-jar ./scalafmt.jar \
scalafmt-native
- run: ls -lh
- run: tar -cvzf scalafmt-native_linux.tgz ./scalafmt-native
- run: ls -lh
- uses: actions/upload-artifact@v1
with:
path: scalafmt-native_linux.tgz
name: scalafmt-native_linux


native-image-mac:
needs: [build-jar]
runs-on: macOS-10.14
steps:
- name: download GraalVM release
env:
VERSION: '19.1.1'
PLATFORM: darwin-amd64
run: |
curl -fsL https://github.com/oracle/graal/releases/download/vm-${VERSION}/graalvm-ce-${PLATFORM}-${VERSION}.tar.gz \
--output graalvm.tgz
tar xzf graalvm.tgz && rm -rf graalvm.tgz
mv graalvm-ce-${VERSION} graalvm
- name: install native-image
env:
BIN_PATH: Contents/Home/bin
run: ./graalvm/${BIN_PATH}/gu install native-image
- uses: actions/download-artifact@v1
with:
name: jar
path: .
- run: ls -lh
- name: Build macOS native image
env:
BIN_PATH: Contents/Home/bin
run: |
./graalvm/${BIN_PATH}/native-image \
--no-fallback \
-jar ./scalafmt.jar \
scalafmt-native
- run: ls -lh
- run: tar -cvzf scalafmt-native_macOS.tgz ./scalafmt-native
- run: ls -lh
- uses: actions/upload-artifact@v1
with:
path: scalafmt-native_macOS.tgz
name: scalafmt-native_macOS



# - uses: actions/checkout@v1
# - name: Run a one-line script
# run: echo Hello, world!
# - name: Run a multi-line script
# run: |
# echo Add other actions to build,
# echo test, and deploy your project.
100 changes: 100 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build
on: [push]

# this format from Azure doesnt seem to be supported yet.
# TODO: find these hardcoded values and eliminate with GHA version
# variables:
# scalafmt_version: v2.0.1
# graalvm_version: '19.1.1'

jobs:
# Initial task to compile a JAR, store as a pipeline artifact to be used by
# downstream builders.
build-jar:
runs-on: ubuntu-18.04
steps:
- name: Install SBT
run: |
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
- name: Build scalafmt with assembly into JAR
env:
SCALAFMT_VERSION: v2.0.1
run: |
git clone https://github.com/scalameta/scalafmt --branch ${SCALAFMT_VERSION} --depth 1
cd scalafmt
sbt cli/assembly
- uses: actions/upload-artifact@v1
with:
path: scalafmt/scalafmt-cli/target/scala-2.12/scalafmt.jar
name: jar

native-image-linux:
needs: [build-jar]
runs-on: ubuntu-18.04
container:
image: oracle/graalvm-ce:19.1.1
steps:
- name: install native-image
run: gu install native-image
- uses: actions/download-artifact@v1
with:
name: jar
path: .
- run: ls -lh
- name: build Linux native image (static)
run: |
native-image \
--static \
--no-fallback \
-jar ./scalafmt.jar \
scalafmt-native
- run: ls -lh
- run: tar -cvzf scalafmt-native_linux.tgz ./scalafmt-native
- run: ls -lh
- uses: actions/upload-artifact@v1
with:
path: scalafmt-native_linux.tgz
name: scalafmt-native_linux


native-image-mac:
needs: [build-jar]
runs-on: macOS-10.14
steps:
- name: download GraalVM release
env:
VERSION: '19.1.1'
PLATFORM: darwin-amd64
run: |
curl -fsL https://github.com/oracle/graal/releases/download/vm-${VERSION}/graalvm-ce-${PLATFORM}-${VERSION}.tar.gz \
--output graalvm.tgz
tar xzf graalvm.tgz && rm -rf graalvm.tgz
mv graalvm-ce-${VERSION} graalvm
- name: install native-image
env:
BIN_PATH: Contents/Home/bin
run: ./graalvm/${BIN_PATH}/gu install native-image
- uses: actions/download-artifact@v1
with:
name: jar
path: .
- run: ls -lh
- name: Build macOS native image
env:
BIN_PATH: Contents/Home/bin
run: |
./graalvm/${BIN_PATH}/native-image \
--no-fallback \
-jar ./scalafmt.jar \
scalafmt-native
- run: ls -lh
- run: tar -cvzf scalafmt-native_macOS.tgz ./scalafmt-native
- run: ls -lh
- uses: actions/upload-artifact@v1
with:
path: scalafmt-native_macOS.tgz
name: scalafmt-native_macOS

0 comments on commit 8231885

Please sign in to comment.