Skip to content

Commit

Permalink
Cache NodeJS in GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Sep 30, 2024
1 parent 64823fe commit c6e076b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
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')
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
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
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

0 comments on commit c6e076b

Please sign in to comment.