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

Cache NodeJS in GHA #23609

Merged
merged 2 commits into from
Sep 30, 2024
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
29 changes: 29 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,35 @@ runs:
with:
distribution: 'temurin' # use same JDK distro as in Trino docker images
java-version: ${{ inputs.java-version }}
- name: Get NodeJS version from parent pom
shell: bash
run: |
node_version=$(grep -m 1 '<dep.frontend-node.version>' "pom.xml" | sed -n 's/.*<dep.frontend-node.version>\(.*\)<\/dep.frontend-node.version>.*/\1/p')
wendigo marked this conversation as resolved.
Show resolved Hide resolved
if [ -n "$node_version" ]; then
echo "node version is $node_version"
echo "NODE_VERSION=$node_version" >>${GITHUB_ENV}
exit 0
fi
- name: Cache and Restore local NodeJS
id: cache-nodejs
if: ${{ format('{0}', inputs.cache) == 'true' && env.NODE_VERSION != '' }}
uses: actions/cache@v4
wendigo marked this conversation as resolved.
Show resolved Hide resolved
with:
# Note: must be same set of paths as for cache:restore mode
path: .node
key: ${{ runner.os }}-nodejs-${{ env.NODE_VERSION }}
restore-keys: |
${{ runner.os }}-nodejs-
- name: Restore local NodeJS
id: cache_restore-nodejs
if: ${{ format('{0}', inputs.cache) == 'restore' && env.NODE_VERSION != '' }}
uses: actions/cache/restore@v4
with:
# Note: must be same set of paths as for cache:true mode
path: .node
key: ${{ runner.os }}-nodejs-${{ env.NODE_VERSION }}
restore-keys: |
${{ runner.os }}-nodejs-
- name: Cache and Restore local Maven repo
id: cache
if: ${{ format('{0}', inputs.cache) == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
fail-fast: false
matrix:
include:
- { java-version: 23, cache: 'restore', cleanup-node: true }
wendigo marked this conversation as resolved.
Show resolved Hide resolved
- { java-version: 23, cache: 'true', cleanup-node: true }
- { java-version: 24-ea, cache: 'restore', cleanup-node: true }
timeout-minutes: 45
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ product-test-reports
.github/bin/redshift/.cluster-identifier
**/dependency-reduced-pom.xml
core/trino-web-ui/src/main/resources/webapp/dist/
.node
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
-b
smart
-Dair.main.basedir=${session.rootDirectory}
-Dnode.tmpdir=${session.rootDirectory}/.node/
2 changes: 1 addition & 1 deletion core/trino-web-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<installDirectory>${project.build.directory}</installDirectory>
<installDirectory>${node.tmpdir}</installDirectory>
</configuration>
<executions>
<execution>
Expand Down
Loading