Skip to content

Commit

Permalink
Updating Codespaces mvn installation script and adding additional tes…
Browse files Browse the repository at this point in the history
…t case to Actions run
  • Loading branch information
peter-murray authored Sep 12, 2023
1 parent c5ad0fd commit da1586f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
14 changes: 9 additions & 5 deletions .devcontainer/install_maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ echo -x
JDK_VERSION="18.0.2.1"
JDK_INSTALLER="/tmp/openjdk.tar.gz"

MVN_VERSION="3.9.0"
MVN_VERSION="3.9.4"
MVN_INSTALLER="/tmp/mvn.tar.gz"

wget https://download.java.net/java/GA/jdk${JDK_VERSION}/db379da656dc47308e138f21b33976fa/1/GPL/openjdk-${JDK_VERSION}_linux-x64_bin.tar.gz -O ${JDK_INSTALLER}
tar -xC /usr/local/sbin -vf ${JDK_INSTALLER}
sudo tar -xC /usr/local/sbin -vf ${JDK_INSTALLER}

ln -s /usr/local/sbin/jdk-${JDK_VERSION}/bin/java /usr/local/sbin/java
ln -s /usr/local/sbin/jdk-${JDK_VERSION}/bin/javac /usr/local/sbin/javac
sudo rm /usr/local/sbin/java
sudo ln -s /usr/local/sbin/jdk-${JDK_VERSION}/bin/java /usr/local/sbin/java

sudo rm /usr/local/sbin/javac
sudo ln -s /usr/local/sbin/jdk-${JDK_VERSION}/bin/javac /usr/local/sbin/javac

wget https://dlcdn.apache.org/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz -O ${MVN_INSTALLER}
tar -xC /usr/local/sbin -vf ${MVN_INSTALLER}

ln -s /usr/local/sbin/apache-maven-${MVN_VERSION}/bin/mvn /usr/local/sbin/mvn
sudo rm /usr/local/sbin/mvn
sudo ln -s /usr/local/sbin/apache-maven-${MVN_VERSION}/bin/mvn /usr/local/sbin/mvn
17 changes: 16 additions & 1 deletion .github/workflows/test_local_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,19 @@ jobs:
- name: Run local Action
uses: ./
with:
directory: ${{ inputs.directory }}
directory: ${{ inputs.directory }}

test_with_arguments:
name: Test

runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Run local Action
uses: ./
with:
directory: ${{ inputs.directory }}
maven-args: ' -X -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
11 changes: 11 additions & 0 deletions src/maven-runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ describe('maven-runner', () => {
// by running with quiet mode there should be no output
expect(results.stdout.length).toBe(0);
});

it('should run path provided maven with additional arguments', async () => {
const projectDir = getMavenProjectDirectory('simple');
const additionalMavenArgs = ' -X -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn';
const runner = new MavenRunner(projectDir, undefined, false, additionalMavenArgs);

const results = await runner.exec(projectDir, ['validate']);
expect(results.exitCode).toBe(0);
// by running with quiet mode there should be no output
expect(results.stdout.length).toBe(0);
});
});

describe('with settings', () => {
Expand Down

0 comments on commit da1586f

Please sign in to comment.