20230803-193129 #142
Workflow file for this run
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 Test | |
on: | |
#push: | |
# branches: [ t8 ] | |
pull_request: | |
branches: [ t8, master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
# -------------------------- | |
- name: Cache OpenAF runtime | |
uses: actions/[email protected] | |
with: | |
key : oaf-t8 | |
path: /tmp/oaf | |
# -------------- | |
- name: Checkout | |
uses: actions/[email protected] | |
# ----------------------- | |
- name: Compile ojob yaml | |
uses: openaf/ojob-action@v4 | |
with: | |
ojob: ojob.io/ojob/compile | |
args: "source=ojob.yaml target=ojob.json" | |
dist: t8 | |
# ------------- | |
- name: Checkin | |
uses: openaf/ojob-action@v4 | |
env : | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
ojob: ojob.io/git/hub/checkIn | |
args: 'message="Update\ ojob.json"' | |
dist: t8 | |
# -------------------- | |
- name: Setup Java JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 1.8 | |
java-package: jdk | |
architecture: x64 | |
# ----------- | |
- name: Build | |
uses: openaf/ojob-action@v4 | |
with: | |
ojob: build.yaml | |
# ----------------------- | |
- name: Update openaf.jar | |
uses: actions/upload-artifact@v3 | |
with: | |
name: openaf.jar | |
path: openaf.jar | |
# ---------------------------- | |
- name: Upload openaf.jar.orig | |
uses: actions/upload-artifact@v3 | |
with: | |
name: openaf.jar.orig | |
path: openaf.jar.orig | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
# -------------------------- | |
- name: Cache OpenAF runtime | |
uses: actions/[email protected] | |
with: | |
key : oaf-t8 | |
path: /tmp/oaf | |
# -------------- | |
- name: Checkout | |
uses: actions/[email protected] | |
# ---------------------------------- | |
- name: Download artifact openaf.jar | |
uses: actions/download-artifact@v3 | |
with: | |
name: openaf.jar | |
path: . | |
# --------------------------------------- | |
- name: Download artifact openaf.jar.orig | |
uses: actions/download-artifact@v3 | |
with: | |
name: openaf.jar.orig | |
path: . | |
# ------------------- | |
- name: Execute tests | |
run : | | |
cd tests | |
java -jar ../openaf.jar --ojob -e "autoTestAll.yaml" | |
# ------------------------------------ | |
- name: Convert autoTestAll.md to html | |
uses: openaf/ojob-action@v4 | |
with: | |
dist: t8 | |
ojob: ojob.io/formats/md2html | |
args: md=tests/autoTestAll.md html=tests/autoTestAll.html compact=true | |
# ---------------------------- | |
- name: Upload autoTestAll.md | |
uses: actions/[email protected] | |
with: | |
name: autoTestAll.html | |
path: tests/autoTestAll.html | |
# --------------------- | |
- name: Generate badges | |
uses: openaf/ojob-action@v4 | |
with: | |
dist: t8 | |
def : | | |
todo: | |
- (if ): | | |
"{{$env 'GITHUB_EVENT_NAME'}}" != "pull_request" | |
((then)): | |
- Create badge results | |
- Create badge asserts | |
((else)): | |
- (log): Ignoring badge generation on pull request | |
ojob: | |
opacks : | |
- openaf: 20230520 | |
- Badgen | |
catch : printErrnl("[" + job.name + "] "); if (isDef(exception.javaException)) exception.javaException.printStackTrace(); else printErr(exception) | |
logToConsole: true # to change when finished | |
templateArgs: true | |
include: | |
- badgen.yaml | |
jobs: | |
# -------------------------- | |
- name: Create badge asserts | |
to : | |
- (template): "{{asserts}}" | |
((outPath): status | |
((key ): args | |
((out ): args | |
- (log ): "Generating badge file '{{file}}'..." | |
- name : Badgen generate file | |
args : | |
labelColor: grey3 | |
icon : "openaf_grey.svg" | |
file : "tests/asserts.svg" | |
exec : | | |
var data = io.readFileJSON("tests/autoTestAll.results.json") | |
args.asserts = data.asserts | |
args.label = "OpenAF tests asserts" | |
args.color = "blue" | |
# -------------------------- | |
- name: Create badge results | |
to : | |
- (template): "(FAIL: {{fail}}, PASS: {{pass}}, TOTAL: {{count}})" | |
((outPath): status | |
((key ): args | |
((out ): args | |
- (log ): "Generating badge file '{{file}}'..." | |
- name : Badgen generate file | |
args : | |
labelColor: grey3 | |
icon : "openaf_grey.svg" | |
file : "tests/results.svg" | |
exec : | | |
var data = io.readFileJSON("tests/autoTestAll.results.json") | |
args.fail = data.fail | |
args.pass = data.pass | |
args.count = data.count | |
args.label = "OpenAF tests" | |
args.color = "green" | |
if (args.fail > 0) args.color = "red" | |
# -------------- | |
- name: Check in | |
uses: openaf/ojob-action@v4 | |
env : | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
def : | | |
todo: | |
- (if ): > | |
"{{$env 'GITHUB_EVENT_NAME'}}" != "pull_request" | |
((then)): | |
- (runfile): ojob.io/git/hub/contentIn | |
((args )): | |
message: "Test results badge" | |
paths : "tests/results.svg,tests/asserts.svg,tests/autoTestAll.md" | |
((else)): | |
- (log): Ignoring check in on pull request | |
dist: t8 | |
# ------------------ | |
- name: Test results | |
run : | | |
grep -q '"fail":0' tests/autoTestAll.results.json || exit -1 |