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

Commit

Permalink
Migration from Azure Pipelines to Github Actions (#5)
Browse files Browse the repository at this point in the history
* initial test of new gh actions beta

building for macos/linux, but not releasing yet. fair amount of ugly and
or duplicative code due to lack of templating features from Azure.

* wip github release of binaries

* disable azure releaser to enable test GHA release

* Finish file cleanup from azure->GHA migration

* add GHA badge
  • Loading branch information
mroth authored Sep 16, 2019
1 parent 18dc27f commit a08d069
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 137 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
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

# Use GraalVM on Linux to convert JAR to a native linux static binary
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

# Use GraalVM on macOS to convert JAR to a native macOS binary
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

# Collate artifacts, upload to GitHub Releases on semver tags
releaser:
needs: [native-image-linux, native-image-mac]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v1
with:
name: scalafmt-native_macOS
path: .
- uses: actions/download-artifact@v1
with:
name: scalafmt-native_linux
path: .
- run: ls -lh
# TODO: generate changelog? or just handle via bump
- name: Release to GitHub
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: "scalafmt*.tgz"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# scalafmt-native

[![Build Status](https://github.com/mroth/scalafmt-native/workflows/Build/badge.svg)](https://github.com/mroth/scalafmt-native/actions)
[
![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/mrothy/scalafmt-native.svg)
![MicroBadger Size](https://img.shields.io/microbadger/image-size/mrothy/scalafmt-native.svg)
Expand Down
86 changes: 0 additions & 86 deletions azure-pipelines.yml

This file was deleted.

51 changes: 0 additions & 51 deletions ci/native-build.yml

This file was deleted.

0 comments on commit a08d069

Please sign in to comment.