Skip to content

Commit

Permalink
Chore/simplify Github Actions scripts (#200)
Browse files Browse the repository at this point in the history
* chore: set dependency versions
* chore: parameterize native-image-musl
  • Loading branch information
dainiusjocas authored Aug 21, 2022
1 parent f3a4064 commit fb34586
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 42 deletions.
85 changes: 45 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ env:
LMGREP_FEATURE_CHARSETS: true
LMGREP_FEATURE_STEMPEL: true
LMGREP_FEATURE_RAUDIKKO: false
CLOJURE_VERSION: '1.11.1.1155'
BABASHKA_VERSION: '0.9.161'
GRAALVM_VERSION: '22.2.0'

jobs:
create-gh-release:
Expand Down Expand Up @@ -44,20 +47,20 @@ jobs:
- uses: actions/checkout@v3.0.2
- uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
version: ${{ env.GRAALVM_VERSION }}
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install clojure tools-deps`
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.11.1.1155
cli: ${{ env.CLOJURE_VERSION }}

- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.5.0
with:
babashka-version: 0.9.161
babashka-version: ${{ env.BABASHKA_VERSION }}

- name: Compile uberjar
run: |
Expand Down Expand Up @@ -92,34 +95,54 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
os: [
ubuntu-latest,
ubuntu-20.04,
macos-latest,
windows-latest
]
include:
- os: ubuntu-latest
platform: linux
gu-binary: gu
arch: 'amd64'
native-image-musl: 'false'
static-suffix: ''
- os: ubuntu-20.04
platform: linux
gu-binary: gu
arch: 'amd64'
native-image-musl: 'true'
static-suffix: '-static'
- os: macos-latest
platform: macos
gu-binary: gu
arch: 'amd64'
native-image-musl: 'false'
static-suffix: ''
- os: windows-latest
platform: windows
gu-binary: gu.exe
arch: 'amd64'
native-image-musl: 'false'
static-suffix: ''
- os: self-hosted
platform: macos
gu-binary: gu
arch: 'aarch64'
native-image-musl: 'false'
static-suffix: ''
steps:
- name: Set env variable with the release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- uses: actions/checkout@v3.0.2
- uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
version: ${{ env.GRAALVM_VERSION }}
java-version: '17'
components: 'native-image'
native-image-musl: ${{ matrix.native-image-musl }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download uberjar from job 'build-uberjar-upload-to-release-and-store-artifacts'
Expand All @@ -128,9 +151,12 @@ jobs:
name: uberjar

- name: Build native-image on *nix
env:
LMGREP_STATIC: ${{ matrix.native-image-musl }}
LMGREP_MUSL: ${{ matrix.native-image-musl }}
run: |
./script/compile
zip lmgrep-${RELEASE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}.zip lmgrep
zip lmgrep-${RELEASE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.static-suffix }}.zip lmgrep
if: runner.os != 'Windows'

- name: Build native-image on Windows and zip it
Expand All @@ -146,47 +172,26 @@ jobs:
name: Release ${{ env.RELEASE_VERSION }}
draft: true
files: |
lmgrep-*-${{ matrix.platform }}-${{ matrix.arch }}.zip
lmgrep-*-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.static-suffix }}.zip
build-native-image-with-musl:
needs: [create-gh-release, build-uberjar-upload-to-release-and-store-artifacts]
name: native-image-musl on ubuntu-latest
- name: Archive static native images as artifacts
uses: actions/upload-artifact@v3
with:
name: static-image
path: lmgrep
if: matrix.native-image-musl == 'true'

docker-image-release:
needs: [ create-gh-release, build-uberjar-upload-to-release-and-store-artifacts, build-native-executables-and-upload-to-release ]
name: docker image release per architecture
runs-on: ubuntu-latest
steps:
- name: Set env variable with the release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- uses: actions/checkout@v3.0.2
- name: Run setup-graalvm action
uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
java-version: '17'
components: 'native-image'
native-image-musl: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download uberjar from job 'build-uberjar-upload-to-release-and-store-artifacts'
- name: Download uberjar from job 'build-native-executables-and-upload-to-release'
uses: actions/download-artifact@v3
with:
name: uberjar

- name: Build static lmgrep image with Native Image and musl
env:
LMGREP_STATIC: true
LMGREP_MUSL: true
run: |
./script/compile
zip lmgrep-${RELEASE_VERSION}-linux-amd64-static.zip lmgrep
- name: Upload ziped binary to the release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Release ${{ env.RELEASE_VERSION }}
draft: true
files: |
lmgrep-*-linux-amd64-static.zip
name: static-image

- name: Login to Docker Hub
uses: docker/login-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Tests
on:
push:

env:
CLOJURE_VERSION: '1.11.1.1155'
BABASHKA_VERSION: '0.9.161'

jobs:
unit-test:

Expand All @@ -27,12 +31,12 @@ jobs:
- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.11.1.1155
cli: ${{ env.CLOJURE_VERSION }}

- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.5.0
with:
babashka-version: 0.9.161
babashka-version: ${{ env.BABASHKA_VERSION }}

- name: Unit Tests
env:
Expand Down

0 comments on commit fb34586

Please sign in to comment.