Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 18 additions & 2 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
name: Build plugin
description: Builds the plugin
inputs:
maven_args:
required: false
description: Extra Maven arguments, such as -Pmat-latest to build against the newest MAT
default: ''
test_jvm_args:
required: false
description: Extra JVM options for the tests, such as a locale or a time zone
default: ''
upload_update_site:
required: false
description: Whether to attach the update site to the workflow run
default: 'true'
runs:
using: "composite"
steps:
- name: Test
shell: bash
env:
BUILD_MAVEN_ARGS: ${{ inputs.maven_args }}
TEST_JVM_ARGS: ${{ inputs.test_jvm_args }}
run: |
./mvnw --color=always -B verify
./mvnw --color=always -B $BUILD_MAVEN_ARGS "-Dtest.jvm.args=$TEST_JVM_ARGS" verify
- uses: actions/upload-artifact@v7
name: Attach generated update site as zip
if: runner.os == 'Linux'
if: inputs.upload_update_site == 'true'
with:
name: mat-calcite-plugin-update-site
# actions/upload-artifact always creates .zip, so we specify directory here to prevent double zip archiving
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/setup_java/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ inputs:
required: true
description: Java version for building the plugin
default: '17'
java_distribution:
required: false
description: Java distribution, as actions/setup-java names it
default: zulu
runs:
using: "composite"
steps:
- name: 'Set up JDK ${{ inputs.java_version }}'
uses: actions/setup-java@v6
with:
distribution: zulu
distribution: ${{ inputs.java_distribution }}
java-version: ${{ inputs.java_version }}
- name: Cache local Maven repository
uses: actions/cache@v6
Expand Down
47 changes: 38 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
pull_request:
branches:
- '**'
# Replays the matrix of an earlier run: its seed is in the step summary of "Matrix Preparation"
workflow_dispatch:
inputs:
matrix_rng_seed:
description: RNG seed
required: false

concurrency:
# On main/release, we don't want any jobs cancelled so the sha is used to name the group
Expand All @@ -16,34 +22,57 @@ concurrency:
cancel-in-progress: true

jobs:
matrix_prep:
name: Matrix Preparation
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
env:
MATRIX_JOBS: 4
# Every push to a pull request draws the same jobs
GITHUB_PR_NUMBER: ${{ github.event.number }}
RNG_SEED: ${{ github.event.inputs.matrix_rng_seed }}
steps:
- name: Checkout sources
uses: actions/checkout@v7
- id: set-matrix
name: Generate the matrix
shell: bash
run: |
npm ci --prefix .github/workflows
node .github/workflows/matrix.mjs

build-test:
needs: matrix_prep
strategy:
matrix:
java: [ 17 ]
os: [ ubuntu-latest, windows-latest ]
name: 'Test, ${{ matrix.os }}, java ${{ matrix.java }}'
runs-on: ${{ matrix.os }}
fail-fast: false
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs_on }}
steps:
- name: Checkout sources
uses: actions/checkout@v7
- name: Setup Java
uses: ./.github/actions/setup_java
with:
java_version: ${{ matrix.java }}
java_version: ${{ matrix.java_version }}
java_distribution: ${{ matrix.java_distribution }}
- name: Build
uses: ./.github/actions/build
with:
java_version: ${{ matrix.java }}
maven_args: ${{ matrix.maven_args }}
test_jvm_args: ${{ matrix.test_jvm_args }}
upload_update_site: ${{ matrix.publish }}
- name: Publish Eclipse update site
if: runner.os == 'Linux' && github.repository == 'vlsi/mat-calcite-plugin' && github.ref == 'refs/heads/main'
if: matrix.publish && github.repository == 'vlsi/mat-calcite-plugin' && github.ref == 'refs/heads/main'
uses: ./.github/actions/publish-update-site
with:
update_site_token:
${{ secrets.UPDATE_SITE_TOKEN }}

ci-gate:
name: CI Gate
needs: [build-test]
needs: [matrix_prep, build-test]
if: always()
runs-on: ubuntu-latest
steps:
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/matrix.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Generates a random subset of the MAT, Java, OS, locale and time zone combinations for CI.
// Preview the jobs with "node .github/workflows/matrix.mjs" after "npm ci --prefix .github/workflows".
// See https://github.com/vlsi/github-actions-random-matrix
import { readFileSync } from 'fs';
import { createGitHubMatrixBuilder, setGitHubOutput } from '@vlsi/github-actions-random-matrix/github';

const { matrix } = createGitHubMatrixBuilder();
matrix.failOnUnsatisfiableFilters(true);

// The Java version each MAT needs is the execution environment the root pom sets for it: the default
// for the oldest supported MAT, the mat-latest profile for the newest one.
const pom = readFileSync(new URL('../../pom.xml', import.meta.url), 'utf8');
const [oldestMatJava, newestMatJava] = [...pom.matchAll(/<mat\.executionEnvironment>JavaSE-(\d+)</g)]
.map(m => Number(m[1]));
if (!oldestMatJava || !newestMatJava) {
throw new Error('pom.xml should set mat.executionEnvironment twice: by default and in the mat-latest profile');
}

matrix.addAxis({
name: 'mat',
title: x => x.title,
values: [
{value: 'oldest', title: 'oldest MAT', maven_args: '', min_java: oldestMatJava},
{value: 'newest', title: 'newest MAT', maven_args: '-Pmat-latest', min_java: newestMatJava},
]
});

matrix.addAxis({
name: 'java_version',
title: x => 'Java ' + x,
// No supported MAT runs on a Java older than the oldest MAT requires
values: ['17', '21', '25'].filter(v => Number(v) >= oldestMatJava)
});

matrix.addAxis({
name: 'java_distribution',
values: ['corretto', 'liberica', 'microsoft', 'temurin', 'zulu']
});

matrix.addAxis({
name: 'os',
title: x => x.value.replace('-latest', ''),
values: [
{value: 'ubuntu-latest', weight: 4},
{value: 'windows-latest', weight: 1},
]
});

// Turkish finds case conversions without an explicit locale, since "I" lowercases to a dotless "ı"
matrix.addAxis({
name: 'locale',
title: x => x.language + '_' + x.country,
values: [
{language: 'en', country: 'US'},
{language: 'de', country: 'DE'},
{language: 'tr', country: 'TR'},
]
});

// Pacific/Chatham has a UTC offset of +12:45, which no whole-hour arithmetic gets right
matrix.addAxis({
name: 'tz',
values: ['UTC', 'America/New_York', 'Pacific/Chatham']
});

matrix.constrain(['mat', 'java_version'], (mat, javaVersion) => Number(javaVersion) >= mat.min_java);

matrix.setNamePattern(['mat', 'java_version', 'java_distribution', 'os', 'locale', 'tz']);

const include = matrix.generateRows(Number(process.env.MATRIX_JOBS || 4), {
require: [
// The update site is built from the oldest supported MAT, on the oldest Java it supports
{
filter: {mat: {value: 'oldest'}, java_version: String(oldestMatJava), os: {value: 'ubuntu-latest'}},
tag: row => { row.publish = true; },
},
...matrix.allAxisValues('mat'),
...matrix.allAxisValues('java_version'),
...matrix.allAxisValues('os'),
],
});
if (include.length === 0) {
throw new Error('Matrix list is empty');
}

include.sort((a, b) => a.name.localeCompare(b.name, undefined, {numeric: true}));
include.forEach(row => {
row.runs_on = row.os.value;
row.maven_args = row.mat.maven_args;
row.test_jvm_args = `-Duser.language=${row.locale.language} -Duser.country=${row.locale.country} -Duser.timezone=${row.tz}`;
row.publish = row.publish === true;
});

if (process.argv.includes('--coverage')) {
const coverage = matrix.pairCoverageReport();
console.log(`Pair coverage: ${coverage.covered}/${coverage.total} (${coverage.percentage}%)`);
} else {
console.log(include);
setGitHubOutput('matrix', {include});
}
21 changes: 21 additions & 0 deletions .github/workflows/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .github/workflows/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"private": true,
"type": "module",
"dependencies": {
"@vlsi/github-actions-random-matrix": "2.4.0"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ dependency-reduced-pom.xml

# Windows image cache files
Thumbs.db
.github/workflows/node_modules/
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## [Unreleased]
### Changed
- Eclipse Memory Analyzer 1.15.0 or higher is required. The plugin supports the newest MAT release that is at least two years old, see "Supported versions" in README.md

## [1.6.2] - 2023-11-17
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions MatCalcitePlugin/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Bundle-SymbolicName: MatCalcitePlugin;singleton:=true
Bundle-Version: 1.6.4.qualifier
Bundle-Vendor: Vladimir Sitnikov
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.mat.api;bundle-version="1.13.0",
org.eclipse.mat.ui;bundle-version="1.13.0",
Require-Bundle: org.eclipse.mat.api;bundle-version="1.15.0",
org.eclipse.mat.ui;bundle-version="1.15.0",
org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.jface.text;bundle-version="3.7.2",
Expand Down
77 changes: 19 additions & 58 deletions MatCalciteTargetPlatform/MatCalciteTargetPlatform.target
Original file line number Diff line number Diff line change
@@ -1,68 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.5"?>
<target includeMode="feature" name="eclipse 4.5.0">
<?pde version="3.8"?>
<!--
The oldest MAT the plugin supports (see "Supported versions" in README.md), and the Eclipse release that MAT
builds against. The plugin compiles against this target, and the update site is built from it.
mat-latest.target lists the newest MAT for the tests.
-->
<target includeMode="feature" name="MAT Calcite: oldest supported MAT">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
<repository location="https://download.eclipse.org/releases/2022-12"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.30/"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.p2.user.ui.feature.group" version="0.0.0"/>
<unit id="org.eclipse.rcp.feature.group" version="0.0.0"/>
<!-- For MatCalciteTest -->
<unit id="org.junit" version="0.0.0"/>
</location>
<location includeDependencyDepth="infinite" includeDependencyScopes="compile,provided,runtime" includeSource="true" label="Maven Central" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>accessors-smart</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
<version>1.36.0</version>
</dependency>
<!-- Calcite asks for an older Avatica; Avatica before 1.29.0 has CVE-2026-70410 -->
<dependency>
<groupId>org.apache.calcite.avatica</groupId>
<artifactId>avatica-core</artifactId>
<version>1.29.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.7.2-jre</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
<version>3.1.12</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.1.12</version>
</dependency>
</dependencies>
<instructions><![CDATA[
-reproducible: true
-noextraheaders: true
Bundle-Name: Bundle derived from maven artifact ${mvnGroupId}:${mvnArtifactId}:${mvnVersion}
version: ${version_cleanup;${mvnVersion}}
Bundle-SymbolicName: wrapped.${mvnGroupId}.${mvnArtifactId}
Bundle-Version: ${version}
Import-Package: *;resolution:=optional
Export-Package: *;version="${version}";-noimport:=true
DynamicImport-Package: *
]]></instructions>
<!-- The MAT feature would bring BIRT and Rhino for the charts, which the plugin does not use -->
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
<repository location="https://download.eclipse.org/mat/1.15.0/update-site/"/>
<unit id="org.eclipse.mat.api" version="0.0.0"/>
<unit id="org.eclipse.mat.report" version="0.0.0"/>
<unit id="org.eclipse.mat.ui" version="0.0.0"/>
<unit id="org.eclipse.mat.parser" version="0.0.0"/>
<unit id="org.eclipse.mat.hprof" version="0.0.0"/>
</location>
<location type="Target" uri="file:${project_loc:/MatCalciteTargetPlatform}/dependencies.target"/>
</locations>
</target>
Loading
Loading