diff --git a/.github/workflows/e2e-cache-dependency-path.yml b/.github/workflows/e2e-cache-dependency-path.yml deleted file mode 100644 index 1c79c081..00000000 --- a/.github/workflows/e2e-cache-dependency-path.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Validate cache with cache-dependency-path option - -on: - push: - branches: - - main - - releases/* - paths-ignore: - - '**.md' - pull_request: - paths-ignore: - - '**.md' - -permissions: - contents: read - -defaults: - run: - shell: bash - -jobs: - gradle1-save: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - steps: - - name: Checkout - uses: actions/checkout@v7 - with: - persist-credentials: false - - name: Run setup-java with the cache for gradle - uses: ./ - id: setup-java - with: - distribution: 'adopt' - java-version: '17' - cache: gradle - cache-dependency-path: __tests__/cache/gradle1/*.gradle* - - name: Create files to cache - # Need to avoid using Gradle daemon to stabilize the save process on Windows - # https://github.com/actions/cache/issues/454#issuecomment-840493935 - run: | - gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1 - if [ ! -d ~/.gradle/caches ]; then - echo "::error::The ~/.gradle/caches directory does not exist unexpectedly" - exit 1 - fi - gradle1-restore: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - needs: gradle1-save - steps: - - name: Checkout - uses: actions/checkout@v7 - with: - persist-credentials: false - - name: Run setup-java with the cache for gradle - uses: ./ - id: setup-java - with: - distribution: 'adopt' - java-version: '11' - cache: gradle - cache-dependency-path: __tests__/cache/gradle1/*.gradle* - - name: Confirm that ~/.gradle/caches directory has been made - run: | - if [ ! -d ~/.gradle/caches ]; then - echo "::error::The ~/.gradle/caches directory does not exist unexpectedly" - exit 1 - fi - ls ~/.gradle/caches/ - gradle2-restore: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - needs: gradle1-save - steps: - - name: Checkout - uses: actions/checkout@v7 - with: - persist-credentials: false - - name: Run setup-java with the cache for gradle - uses: ./ - id: setup-java - with: - distribution: 'adopt' - java-version: '11' - cache: gradle - cache-dependency-path: __tests__/cache/gradle2/*.gradle* - - name: Confirm that ~/.gradle/caches directory has not been made - run: | - if [ -d ~/.gradle/caches ]; then - echo "::error::The ~/.gradle/caches directory exists unexpectedly" - exit 1 - fi diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index c76cf50b..14d739e6 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -222,3 +222,310 @@ jobs: exit 1 fi ls ~/.cache/coursier + gradle1-save: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for gradle + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '17' + cache: gradle + cache-dependency-path: __tests__/cache/gradle1/*.gradle* + - name: Create files to cache + # Need to avoid using Gradle daemon to stabilize the save process on Windows + # https://github.com/actions/cache/issues/454#issuecomment-840493935 + run: | + gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1 + if [ ! -d ~/.gradle/caches ]; then + echo "::error::The ~/.gradle/caches directory does not exist unexpectedly" + exit 1 + fi + gradle1-restore: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + needs: gradle1-save + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for gradle + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: gradle + cache-dependency-path: __tests__/cache/gradle1/*.gradle* + - name: Confirm that ~/.gradle/caches directory has been made + run: | + if [ ! -d ~/.gradle/caches ]; then + echo "::error::The ~/.gradle/caches directory does not exist unexpectedly" + exit 1 + fi + ls ~/.gradle/caches/ + gradle2-restore: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + needs: gradle1-save + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for gradle + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: gradle + cache-dependency-path: __tests__/cache/gradle2/*.gradle* + - name: Confirm that ~/.gradle/caches directory has not been made + run: | + if [ -d ~/.gradle/caches ]; then + echo "::error::The ~/.gradle/caches directory exists unexpectedly" + exit 1 + fi + maven1-save: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-15-intel, windows-latest, ubuntu-latest] + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for maven + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: maven + cache-dependency-path: __tests__/cache/maven/pom.xml + - name: Create files to cache + run: | + mvn verify -f __tests__/cache/maven/pom.xml + if [ ! -d ~/.m2/repository ]; then + echo "::error::The ~/.m2/repository directory does not exist unexpectedly" + exit 1 + fi + maven1-restore: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-15-intel, windows-latest, ubuntu-latest] + needs: maven1-save + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for maven + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: maven + cache-dependency-path: __tests__/cache/maven/pom.xml + - 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 + maven2-restore: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-15-intel, windows-latest, ubuntu-latest] + needs: maven1-save + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for maven + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: maven + cache-dependency-path: __tests__/cache/maven2/pom.xml + - name: Confirm that ~/.m2/repository directory has not been made + run: | + if [ -d ~/.m2/repository ]; then + echo "::error::The ~/.m2/repository directory exists unexpectedly" + exit 1 + fi + sbt1-save: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: __tests__/cache/sbt + strategy: + fail-fast: false + matrix: + os: [macos-15-intel, windows-latest, ubuntu-22.04] + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for sbt + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: sbt + cache-dependency-path: __tests__/cache/sbt/*.sbt + - name: Setup SBT + if: matrix.os == 'macos-15-intel' + run: | + echo ""Installing SBT..."" + brew install sbt + - name: Create files to cache + run: sbt update + + - name: Check files to cache on macos-latest + if: matrix.os == 'macos-15-intel' + run: | + if [ ! -d ~/Library/Caches/Coursier ]; then + echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" + exit 1 + fi + - name: Check files to cache on windows-latest + if: matrix.os == 'windows-latest' + run: | + if [ ! -d ~/AppData/Local/Coursier/Cache ]; then + echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly" + exit 1 + fi + - name: Check files to cache on ubuntu-latest + if: matrix.os == 'ubuntu-22.04' + run: | + if [ ! -d ~/.cache/coursier ]; then + echo "::error::The ~/.cache/coursier directory does not exist unexpectedly" + exit 1 + fi + sbt1-restore: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: __tests__/cache/sbt + strategy: + fail-fast: false + matrix: + os: [macos-15-intel, windows-latest, ubuntu-22.04] + needs: sbt1-save + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for sbt + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: sbt + cache-dependency-path: __tests__/cache/sbt/*.sbt + + - name: Confirm that ~/Library/Caches/Coursier directory has been made + if: matrix.os == 'macos-15-intel' + run: | + if [ ! -d ~/Library/Caches/Coursier ]; then + echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" + exit 1 + fi + ls ~/Library/Caches/Coursier + - name: Confirm that ~/AppData/Local/Coursier/Cache directory has been made + if: matrix.os == 'windows-latest' + run: | + if [ ! -d ~/AppData/Local/Coursier/Cache ]; then + echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly" + exit 1 + fi + ls ~/AppData/Local/Coursier/Cache + - name: Confirm that ~/.cache/coursier directory has been made + if: matrix.os == 'ubuntu-22.04' + run: | + if [ ! -d ~/.cache/coursier ]; then + echo "::error::The ~/.cache/coursier directory does not exist unexpectedly" + exit 1 + fi + ls ~/.cache/coursier + sbt2-restore: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: __tests__/cache/sbt2 + strategy: + fail-fast: false + matrix: + os: [macos-15-intel, windows-latest, ubuntu-22.04] + needs: sbt1-save + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Run setup-java with the cache for sbt + uses: ./ + id: setup-java + with: + distribution: 'adopt' + java-version: '11' + cache: sbt + cache-dependency-path: __tests__/cache/sbt2/*.sbt + + - name: Confirm that ~/Library/Caches/Coursier directory has not been made + if: matrix.os == 'macos-15-intel' + run: | + if [ -d ~/Library/Caches/Coursier ]; then + echo "::error::The ~/Library/Caches/Coursier directory exists unexpectedly" + exit 1 + fi + - name: Confirm that ~/AppData/Local/Coursier/Cache directory has not been made + if: matrix.os == 'windows-latest' + run: | + if [ -d ~/AppData/Local/Coursier/Cache ]; then + echo "::error::The ~/AppData/Local/Coursier/Cache directory exists unexpectedly" + exit 1 + fi + - name: Confirm that ~/.cache/coursier directory has not been made + if: matrix.os == 'ubuntu-22.04' + run: | + if [ -d ~/.cache/coursier ]; then + echo "::error::The ~/.cache/coursier directory exists unexpectedly" + exit 1 + fi diff --git a/__tests__/cache/maven2/.gitignore b/__tests__/cache/maven2/.gitignore new file mode 100644 index 00000000..0e13eebb --- /dev/null +++ b/__tests__/cache/maven2/.gitignore @@ -0,0 +1,11 @@ +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar diff --git a/__tests__/cache/maven2/pom.xml b/__tests__/cache/maven2/pom.xml new file mode 100644 index 00000000..70b8d0cc --- /dev/null +++ b/__tests__/cache/maven2/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + io.github.actions + setup-java-maven2-example + 1.0.0-SNAPSHOT + jar + + + org.apache.commons + commons-lang3 + 3.12.0 + + + diff --git a/__tests__/cache/sbt2/.gitignore b/__tests__/cache/sbt2/.gitignore new file mode 100644 index 00000000..2f7896d1 --- /dev/null +++ b/__tests__/cache/sbt2/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/__tests__/cache/sbt2/build.sbt b/__tests__/cache/sbt2/build.sbt new file mode 100644 index 00000000..c8737676 --- /dev/null +++ b/__tests__/cache/sbt2/build.sbt @@ -0,0 +1,3 @@ +ThisBuild / scalaVersion := "2.12.15" + +libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "2.1.1"