ribaraka commented on code in PR #1833:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1833#discussion_r1810536601


##########
.github/workflows/main.yml:
##########
@@ -135,10 +158,32 @@ jobs:
       - uses: actions/setup-go@v4
         with:
           go-version: ${{ matrix.go }}
+      - name: Install Java
+        run: |
+          curl -s "https://get.sdkman.io"; | bash
+          source "$HOME/.sdkman/bin/sdkman-init.sh"
+          echo "sdkman_auto_answer=true" >> ~/.sdkman/etc/config
+          # sdk list java
+
+          sdk install java 11.0.24-zulu
+          echo "JAVA11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
+
+          sdk install java 17.0.12-zulu
+          echo "JAVA17_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
+
+          # by default use JDK 11
+          sdk default java 11.0.24-zulu
+          sdk use java 11.0.24-zulu
+          echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
+          echo "PATH=$PATH" >> $GITHUB_ENV
       - name: Install CCM
-        run: pip install 
"git+https://github.com/riptano/ccm.git@${CCM_VERSION}";
+        run: |
+          python3 -m venv ~/venv
+          ~/venv/bin/pip install setuptools
+          ~/venv/bin/pip install 
"git+https://github.com/riptano/ccm.git@${CCM_VERSION}";

Review Comment:
   How about an idea to create a separate script file to combine the duplicated 
installation steps for Java and CCM? You can then reuse this script across all 
jobs for setup. It will reduce duplication and centralize maintenance. This 
way, if you need to update the installation logic for Java or CCM in the 
future, you can do it in one place instead of multiple jobs. The workflow 
becomes more nice and readable with a simple call to the script. 
   Adding caching to the installation process can speed up builds by reusing 
dependencies (e.g., SDKMAN, Java versions, Python packages) across workflow 
runs. 
   
   I’ve put together an example of this approach, which you can check out here: 
https://github.com/ribaraka/gocql/pull/26



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to