Test SDKman caching #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright 2023 The original authors | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: Build | |
on: | |
# TODO drop this for final change | |
workflow_dispatch: { } | |
push: | |
# TODO restore this for final change | |
# branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Check out repository' | |
uses: actions/checkout@v2 | |
with: | |
submodules: 'true' | |
- name: 'Setup SDKMAN' | |
uses: sdkman/sdkman-action@b1f9b696c79148b66d3d3a06f7ea801820318d0f | |
id: sdkman | |
# TODO restore this for final change | |
# if: github.event_name == 'pull_request' | |
- name: 'Setup Java SDK' | |
shell: bash | |
run: | | |
source "$HOME/.sdkman/bin/sdkman-init.sh" | |
echo "Y" | sdk install java 21.0.1-tem | |
ls -l "$HOME/.sdkman/candidates/java" | |
- name: 'Build project' | |
run: | | |
source "$HOME/.sdkman/bin/sdkman-init.sh" | |
./mvnw --version | |
./mvnw -B clean verify -Pci | |
# TODO restore this for final change | |
- name: 'Test submission' | |
shell: bash | |
run: | | |
source "$HOME/.sdkman/bin/sdkman-init.sh" | |
echo "n" | sdk install java 21.0.2-graal | |
ls -l "$HOME/.sdkman/candidates/java" | |
# ./test_ci.sh ${{ github.event.pull_request.user.login }} | |
# if: github.event_name == 'pull_request' | |
- name: Cache SDKMan | |
id: cache-sdkman | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sdkman | |
key: ${{ runner.os }}-sdkman | |
- name: 'Cache Maven packages' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |