Skip to content
Open
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
86 changes: 81 additions & 5 deletions .github/workflows/ci2.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,81 @@
- name: Trigger Build with Inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: CI Pipeline
inputs: '{ "image_tag": ""}'
name: CI Pipeline

on:
push:
branches:
- main
pull_request:

workflow_dispatch:
inputs:
image_tag:
description: 'Image tag name'
required: false
default: 'latest'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

- name: Compile sysfoo app
run: mvn compile

test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
job: [unit-test, sca, sbom]
name: Run ${{ matrix.job }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

- name: Run ${{ matrix.job }}
run: |
if [ "${{ matrix.job }}" == "unit-test" ]; then
mvn clean test
elif [ "${{ matrix.job }}" == "sca" ]; then
sleep 4
elif [ "${{ matrix.job }}" == "sbom" ]; then
sleep 2
fi

package:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

- name: Package app
run: mvn package -DskipTests

- name: Archive JAR
uses: actions/upload-artifact@v4
with:
name: sysfoo-artifact
path: target/*.jar