Test #71
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: Test | |
on: | |
# Run on push, pull request, and manual trigger | |
push: | |
# Only run when the specific files are changed | |
paths: | |
- '**/*.java' # Java files | |
- '**/*.py' # Python files | |
# Unlike push, the workflow always runs on pull requests | |
pull_request: | |
# The workflow also can be triggered manually, and choose whether | |
# to run with or without debug mode | |
workflow_dispatch: | |
inputs: | |
debug: | |
description: 'Debug Mode' | |
required: false | |
type: boolean | |
# Environment variables definitions | |
env: | |
## For Java installation | |
java-dist: temurin | |
## For Python installation | |
arch: x64 | |
## Other environments | |
debug: ${{ inputs.debug }} | |
deps: requirements.txt | |
jobs: | |
# ::---:: Maven Test ::---:: # | |
maven-test: | |
name: Maven Test / ${{ matrix.os }} / ${{ matrix.java-ver }} | |
runs-on: ${{ matrix.os }}-latest | |
env: | |
# Maven's debug flag (`-X`) | |
mvnDebugFlag: ${{ inputs.debug == true && '-X' || '' }} | |
strategy: | |
# Set to maximum number of processes to speed up jobs run | |
max-parallel: 6 | |
matrix: | |
os: [Ubuntu, Windows, macOS] | |
java-ver: [11, latest] # JDK 11 & latest | |
steps: | |
# Checkout repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Caching Maven deps | |
- name: Cache Maven dependencies | |
id: cache-maven | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-jdk-${{ matrix.java-ver }}-${{ env.java-dist }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-jdk-${{ matrix.java-ver }}-${{ env.java-dist }}-maven-${{ hashFiles('**/pom.xml') }} | |
${{ runner.os }}-jdk-${{ matrix.java-ver }}-${{ env.java-dist }}-maven- | |
# Setup Java | |
- name: Setup Java / ${{ matrix.os }} / ${{ matrix.java-ver }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java-ver }} | |
distribution: ${{ env.java-dist }} | |
# Install deps | |
- name: Install dependencies | |
if: ${{ steps.cache-maven.outputs.cache-hit != true }} | |
run: mvn clean install -DskipTests ${{ env.mvnDebugFlag }} | |
shell: bash | |
# Packaging and testing | |
- name: Packaging the project | |
run: mvn package -P include-src ${{ env.mvnDebugFlag }} | |
shell: bash | |
# Build the docs | |
- name: Build the HTML docs | |
run: mvn site -P lint ${{ env.mvnDebugFlag }} | |
shell: bash | |
# Clean up | |
- name: Clean up the project | |
run: | | |
mvn clean ${{ env.mvnDebugFlag }} | |
[ -d docs/jmatrix-* ] && rm --recursive --force docs/jmatrix-* | |
shell: bash | |
# ::---:: Make Test ::---:: # | |
make-test: | |
name: Make Test / ${{ matrix.os }} / ${{ matrix.py-ver }} | |
runs-on: ${{ matrix.os }}-latest | |
env: | |
MAKE: ${{ inputs.debug == true && 'make -d' || 'make' }} | |
strategy: | |
# Set to maximum number of processes to speed up jobs run | |
max-parallel: 6 | |
matrix: | |
os: [Ubuntu, Windows, macOS] | |
py-ver: [3.7, 3.x] # Python 3.7 & latest | |
steps: | |
# Checkout | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Setup Python | |
- name: Setup Python / ${{ matrix.os }} / ${{ matrix.py-ver }} | |
id: setup-py | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.py-ver }} | |
architecture: ${{ env.arch }} | |
cache: pip | |
cache-dependency-path: '**/${{ env.deps }}' | |
# Install deps | |
- name: Install dependencies | |
if: ${{ steps.setup-py.outputs.cache-hit != true }} | |
run: | | |
if [ $debug = 'true' ]; then | |
python -m pip install -r $(git ls-files **/$deps) --debug | |
else | |
python -m pip install -r $(git ls-files **/$deps) | |
fi | |
shell: bash | |
# Sadly, Make cannot tests the project thoroughly due to unavailability | |
# of necessary packages (e.g "org.junit"), so here it just tests | |
# the project on compiling, packaging, and generating docs. | |
# Compile | |
- name: Compile the project | |
run: | | |
[ -d target ] && make clean > /dev/null | |
$MAKE compile LINT=true VERBOSE=$debug | |
shell: bash | |
# Package | |
- name: Packaging the project | |
run: $MAKE package INCLUDE_SRC=true VERBOSE=$debug | |
shell: bash | |
# Build docs | |
- name: Build the HTML docs | |
# For more information on debugging, it will implictly set the | |
# verbose mode to 'all' when the VERBOSE is true. | |
run: $MAKE build-docs LINT=true VERBOSE=$debug | |
shell: bash | |
# Clean up | |
- name: Clean up the project | |
run: $MAKE clean VERBOSE=$debug | |
shell: bash |