Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI workflow for Pull Requests #259

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
on:
pull_request:
branches: [master]

jobs:
build-jar:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3.0.2

- name: Version
id: version
# Get version from project.clj
kkinnear marked this conversation as resolved.
Show resolved Hide resolved
run: echo ::set-output name=zprint::$(awk -F "\"" '{print $2}' project.clj | head -n 1)

- name: Setup Clojure
uses: zharinov/clj-toolbox@v1.0.0
with:
leiningen: "2.9.10"

- name: Uberjar
run: lein uberjar

- name: Upload artifacts
uses: actions/upload-artifact@v3.1.0
with:
name: jar-files
path: target/zprint-filter-${{ steps.version.outputs.zprint }}

build-native:
needs: build-jar

runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v3.0.0
with:
name: jar-files
path: target/

- name: Version
id: version
# Get version from uberjar name
run: echo ::set-output name=zprint::$(ls target/zprint-filter-* | sed 's/.*zprint-filter-//')

- name: Setup GraalVM
uses: zharinov/clj-toolbox@v1.0.0
with:
java: graalvm
java-version: 17

- name: Native image
env:
LC_ALL: C.UTF-8
run: native-image
--no-server
-J-Xmx7G
-J-Xms4G
-jar target/zprint-filter-${{ steps.version.outputs.zprint }}
-H:Name="zprintl-${{ steps.version.outputs.zprint }}"
-H:EnableURLProtocols=https,http
-H:+ReportExceptionStackTraces
--report-unsupported-elements-at-runtime
--initialize-at-build-time
--no-fallback

- name: Upload artifacts
uses: actions/upload-artifact@v3.1.0
with:
name: zprintl
path: zprintl-${{ steps.version.outputs.zprint }}

test-native:
needs: build-native

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3.0.2

- name: Setup Babashka
uses: zharinov/clj-toolbox@v1.0.0
with:
babashka: "0.9.161"

- name: Download artifacts
uses: actions/download-artifact@v3.0.0
with:
name: zprintl

- name: Version
id: version
# Get version from binary name
run: echo ::set-output name=zprint::$(ls zprintl-* | sed 's/zprintl-//')

- run: chmod +x zprintl-${{ steps.version.outputs.zprint }}

- name: Run tests
run: ./test_config ${{ steps.version.outputs.zprint }} graalvm-linux

test-clj:
needs: build-jar

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3.0.2

- name: Setup Clojure
uses: zharinov/clj-toolbox@v1.0.0

- name: Download artifacts
uses: actions/download-artifact@v3.0.0
with:
name: jar-files
path: target/

- name: Run tests
run: clojure -Srepro -M:cljtest:humane:runner

test-jar:
needs: build-jar

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3.0.2

- name: Version
id: version
# Get version from project.clj
run: echo ::set-output name=zprint::$(awk -F "\"" '{print $2}' project.clj | head -n 1)

- name: Setup Clojure
uses: zharinov/clj-toolbox@v1.0.0
with:
babashka: "0.9.161"

- name: Download artifacts
uses: actions/download-artifact@v3.0.0
with:
name: jar-files
path: target/

- name: Run tests
run: ./test_config ${{ steps.version.outputs.zprint }} uberjar
2 changes: 1 addition & 1 deletion test_config
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ tests_failed=0

# Let it come up

sleep 5
sleep 10

#
# Try --url
Expand Down