Skip to content

update

update #33

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
# on:
# push:
# branches: [ standalonetest ]
on:
push:
tags:
- v*.*.*
jobs:
front:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: correctexam/corrigeExamFront
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# caching node_modules
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install all system dependencies
run: sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
npm ci
- name: Build
run: |
npm run webapp:build:prodlocal
- name: Lint
run: |
npm run lint
- name: Test
run: |
npm run test
- name: Copy 404
run: |
npm run copy:404
- name: Upload front
uses: actions/upload-artifact@v3
with:
name: front
path: target/classes/static/
retention-days: 1
build-native-image:
needs: [front]
name: 'Build Native Image'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
experimental: [true]
#windows-latest, macos-latest, ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
version: '22.3.2'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Download front
uses: actions/download-artifact@v3
with:
name: front
path: src/main/resources/META-INF/resources/
- name: Native build using maven # https://graalvm.github.io/native-build-tools/latest/maven-plugin.html
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
run: mvn --activate-profiles "native,alone" clean package
- name: Native build using maven for windows # https://graalvm.github.io/native-build-tools/latest/maven-plugin.html
if: startsWith(matrix.os, 'windows')
run: mvn --activate-profiles "native,alonewindows" clean package -DskipTests
- name: rename mac
if: startsWith(matrix.os, 'macos')
run: ls -l target/* && mv target/correctexam-1.0.0-SNAPSHOT-runner* target/correctexam-macos-runner
- name: rename linux
if: startsWith(matrix.os, 'ubuntu')
run: ls -l target/* && mv target/correctexam-1.0.0-SNAPSHOT-runner* target/correctexam-linux-runner
- name: prepare Windows Folder
if: startsWith(matrix.os, 'windows')
# run: cp target/correctexam-1.0.0-SNAPSHOT-runner* distwindows/correctexam-windows-runner.exe
run: copy target\correctexam-1.0.0-SNAPSHOT-runner* distwindows\correctexam-windows-runner.exe
- name: Upload binary linux
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu-latest')
with:
name: correctexam.standalone.linux
path: target/correctexam-linux-runner
retention-days: 1
- name: Upload sbom
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu-latest')
with:
name: correctexam.standalone.bom.back
path: target/bom.json
retention-days:
- name: Upload binary macos
uses: actions/upload-artifact@v2
if: startsWith(matrix.os, 'macos')
with:
name: correctexam.standalone.macos
path: target/correctexam-macos-runner
retention-days: 1
- name: Upload binary windows
uses: actions/upload-artifact@v2
if: startsWith(matrix.os, 'windows')
with:
name: correctexam.standalone.windows
path: distwindows
retention-days: 1
publish-native-image:
needs: [build-native-image]
name: 'Publish Native Image'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
experimental: [true]
#windows-latest,, macos-latest, ubuntu-latest
steps:
- name: Download ubuntu binary
uses: actions/download-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: correctexam.standalone.linux
path: correctexam.standalone.linux
- name: Download bom
uses: actions/download-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: correctexam.standalone.bom.back
path: correctexam.standalone.bom.back
- name: Download macos binary
uses: actions/download-artifact@v3
if: startsWith(matrix.os, 'macos')
with:
name: correctexam.standalone.macos
path: correctexam.standalone.macos
- name: Download windows binary
uses: actions/download-artifact@v3
if: startsWith(matrix.os, 'windows')
with:
name: correctexam.standalone.windows
path: correctexam.standalone.windows
- name: Release standalone linux
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'ubuntu')
# if: startsWith(github.ref, 'refs/tags/')
with:
files: |
correctexam.standalone.linux/correctexam-linux-runner
correctexam.standalone.bom.back/bom.json
# tag_name: v1
- name: Release standalone macos
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'macos')
# if: startsWith(github.ref, 'refs/tags/')
with:
files: correctexam.standalone.macos/correctexam-macos-runner
# tag_name: v1
- name: Release standalone windows
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'windows')
# if: startsWith(github.ref, 'refs/tags/')
with:
files: |
correctexam.standalone.windows/*
# correctexam.standalone.windows/mydb.mv.db
# correctexam.standalone.windows/mydb.trace.db
# tag_name: v1