Skip to content

testing gitlab ci translated to github actions #5

testing gitlab ci translated to github actions

testing gitlab ci translated to github actions #5

Workflow file for this run

name: 'testing TODO-parser on TODO branch'
# This workflow is triggered on pushes, pull requests, or can be run manually.
on:
push:
branches: [ main, master ] # Adjust to your default branch
pull_request:
branches: [ main, master ] # Adjust to your default branch
workflow_dispatch:
# Environment variables available to all jobs in the workflow
env:
TESTED_BRANCH: master
TESTED_PARSER: jsoniq
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
# This is the correct way to check out your repository code
- name: Checkout Repository
uses: actions/checkout@v4
with:
repository: RumbleDB/rumble
ref: ${{ env.TESTED_BRANCH }}
path: rumble
# The 'maven-version' input is no longer valid and has been removed.
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
# Cache Maven dependencies for faster builds
cache: 'maven'
- name: Build with Maven
run: mvn clean compile assembly:single -quiet
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: rumble-target
path: target
test:
name: Test - ${{ matrix.test_name }}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test_name: [ 'app', 'array', 'fn1', 'fn2', 'map', 'math', 'misc', 'op', 'prod1', 'prod2', 'ser', 'xs' ]
continue-on-error: true
steps:
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: rumble-target
path: target
- name: Run Maven Tests
id: run-tests
run: |
# Capitalize the first letter of the test_name to form the class name
TEST_CLASS=$(echo ${{ matrix.test_name }} | awk '{print toupper(substr($0,1,1))substr($0,2)}')Test
if [ "${{ env.TESTED_PARSER }}" = "jsoniq" ]; then
mvn -Dtest=${TEST_CLASS} test -quiet
else
mvn -Dtest=XQuery${TEST_CLASS} test -quiet
fi
- name: Upload Surefire reports
if: always()
uses: actions/upload-artifact@v4
with:
name: surefire-report-${{ matrix.test_name }}
path: target/surefire-reports/*.xml
retention-days: 7
spotless-check:
name: Spotless Check
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: rumble-target
path: target
- name: Run Spotless Check
run: mvn spotless:check
publish-test-results:
name: Publish Test Results
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- name: Download all surefire reports
uses: actions/download-artifact@v4
with:
pattern: surefire-report-*
path: all-surefire-reports
merge-multiple: true
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-results-action@v2
with:
files: all-surefire-reports/**/*.xml
collect:
name: Collect Artifacts
needs: [test, spotless-check]
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@v4 # Checkout needed for analytics scripts
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: rumble-target
path: target
- name: Download all surefire reports
uses: actions/download-artifact@v4
with:
pattern: surefire-report-*
path: all-surefire-reports
merge-multiple: true
- name: Collect and process artifacts
run: |
mkdir -p collected-artifacts/surefire-reports
# The download artifact action now places surefire reports in the correct directory
# so we just need to ensure the target/surefire-reports dir exists for the next step
mkdir -p target/surefire-reports
cp all-surefire-reports/*.xml target/surefire-reports/
cp -r target/surefire-reports collected-artifacts/
# Run the collection/analytics Java code
mvn compile
mvn exec:java
- name: Upload collected data
uses: actions/upload-artifact@v4
with:
name: collected-data
path: |
collected-artifacts
analytics-results
plot:
name: Analytics and Plotting
needs: collect
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@v4 # Checkout needed for analytics scripts
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Download collected data
uses: actions/download-artifact@v4
with:
name: collected-data
path: .
- name: Install dependencies and run plotting script
run: |
pip install -r analytics/requirements.txt
python analytics/plot.py
echo "TO SEE THE PLOTS, CHECK THE ARTIFACTS OF THIS WORKFLOW RUN"
- name: Upload plots
uses: actions/upload-artifact@v4
with:
name: plots-and-results
path: |
plots
analytics-results