mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 02:16:45 +00:00
add an e2e test for maven
This commit is contained in:
parent
3e2fde2f83
commit
a5a0c525bb
2 changed files with 74 additions and 3 deletions
61
.github/workflows/e2e-cache.yml
vendored
61
.github/workflows/e2e-cache.yml
vendored
|
@ -15,7 +15,7 @@ defaults:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
save:
|
gradle-save:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -39,13 +39,13 @@ jobs:
|
||||||
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
|
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
restore:
|
gradle-restore:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
needs: save
|
needs: gradle-save
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -70,3 +70,58 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
ls ~/.gradle/caches/
|
ls ~/.gradle/caches/
|
||||||
|
maven-save:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Run setup-java with the cache for maven
|
||||||
|
uses: ./
|
||||||
|
id: setup-java
|
||||||
|
with:
|
||||||
|
distribution: 'adopt'
|
||||||
|
java-version: '11'
|
||||||
|
cache: maven
|
||||||
|
- name: Create files to cache
|
||||||
|
run: |
|
||||||
|
cp __tests__/cache/maven/pom.xml .
|
||||||
|
mvn verify
|
||||||
|
if [ ! -d ~/.m2/repository ]; then
|
||||||
|
echo "::error::The ~/.m2/repository directory does not exist unexpectedly"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
maven-restore:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
|
needs: save
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Create pom.xml
|
||||||
|
run: |
|
||||||
|
cp __tests__/cache/maven/pom.xml .
|
||||||
|
if [ -d ~/.m2/repository ]; then
|
||||||
|
echo "::error::The ~/.m2/repository directory exists unexpectedly"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Run setup-java with the cache for maven
|
||||||
|
uses: ./
|
||||||
|
id: setup-java
|
||||||
|
with:
|
||||||
|
distribution: 'adopt'
|
||||||
|
java-version: '11'
|
||||||
|
cache: maven
|
||||||
|
- name: Confirm that ~/.m2/repository directory has been made
|
||||||
|
run: |
|
||||||
|
if [ ! -d ~/.m2/repository ]; then
|
||||||
|
echo "::error::The ~/.m2/repository directory does not exist unexpectedly"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ls ~/.m2/repository
|
||||||
|
|
16
__tests__/cache/maven/pom.xml
vendored
Normal file
16
__tests__/cache/maven/pom.xml
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>io.github.actions</groupId>
|
||||||
|
<artifactId>setup-java-maven-example</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>5.7.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
Loading…
Add table
Add a link
Reference in a new issue