Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test only supported Groovy versions and automate their testing #269

Merged
merged 3 commits into from
Sep 25, 2023
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
41 changes: 32 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,44 @@ on:
branches:
- master

env:
MAVEN_OPTS: '-Xms2048m -Xmx2048m'
MAVEN_ARGS: >-
--show-version
--errors
--batch-mode
--no-transfer-progress
-Dinvoker.streamLogsOnFailures=true
-Pnonindy

defaults:
run:
shell: 'bash -o errexit -o nounset -o pipefail {0}'
Comment on lines +21 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you do that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because what's often call the "strict" mode of Bash isn't on by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but the bash is terminated right afterwards. It does not affect subsequent runs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For errexit, It's true it won't affect other runs or jobs, but it would affect subsequent commands in the same job.
At the moment, we only have a single command, so it doesn't add any value, but if there were ever a second command added, the second command would execute even if the first command failed. That's usually not desirable.

nounset was there to prevent us from accidentally using a variable that wasn't set.

pipefail is another one that doesn't matter right now because we've only got 1 command taking from a pipe (and it's one I added with this PR).

I just had added this since it's what I put on all my Bash scripts (unless I have a specific reason not to).


jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
groovy-version:
- 2.5.23
- 3.0.19
- 4.0.15
# - 5.0.0-alpha-2
env:
MVN_GROOVY_GROUP_ID: ${{format('{0}{1}', '-DgroovyVersion=', matrix.groovy-version)}}
MVN_GROOVY_VERSION: ${{(startsWith(matrix.groovy-version, '2') || startsWith(matrix.groovy-version, '3')) && '-DgroovyGroupId=org.codehaus.groovy' || '-DgroovyGroupId=org.apache.groovy' }}
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: jdk setup
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-package: jdk
architecture: x64
# - name: unit test
# run: ./mvnw --batch-mode --activate-profiles indy clean test
# - name: integration test
# run: ./mvnw --batch-mode --activate-profiles indy -Dmaven.test.skip=true clean install invoker:install invoker:run
- name: full test
run: ./mvnw --batch-mode clean install invoker:install invoker:run
run: >-
./mvnw ${MAVEN_ARGS}
${MVN_GROOVY_GROUP_ID}
${MVN_GROOVY_VERSION}
clean install invoker:install invoker:run
81 changes: 0 additions & 81 deletions integrationTestSuite.groovy

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
*/
protected static final Version GROOVY_1_8_3 = new Version(1, 8, 3);

/*
* TODO: support Groovy 1.5.0 - 1.8.1?
* For some reason, the JavaStubCompilationUnit is silently not creating my stubs
* (although it does create the target directory) when I use other versions.
*/

/**
* The encoding of source files.
*/
Expand Down