Merge pull request #2 from smkniazi/branch-477 #3
This file contains hidden or 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
| name: CI | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # needed for git describe | |
| - name: Setup JDK 24 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 24 | |
| cache: 'maven' | |
| - name: Create Maven settings | |
| run: | | |
| mkdir -p ~/.m2 | |
| if [ -n "${{ secrets.MAVEN_SETTINGS_BASE64 }}" ]; then | |
| echo "${{ secrets.MAVEN_SETTINGS_BASE64 }}" | base64 -d > ~/.m2/settings.xml | |
| fi | |
| - name: Free disk space | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: false | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: false | |
| swap-storage: true | |
| - name: Build | |
| run: ./mvnw clean install -DskipTests | |
| - name: Clean Maven artifacts | |
| if: github.event_name == 'push' | |
| run: rm -rf ~/.m2/repository/io/trino/ | |
| - name: Set Docker Registry | |
| if: github.event_name == 'push' | |
| run: | | |
| echo "DOCKER_REGISTRY=docker.hops.works/dev/salman/trino" >> $GITHUB_ENV | |
| #Uncomment once we are ready to release | |
| #if [[ "${{ github.repository }}" == "logicalclocks/trino" && "${{ github.ref }}" == refs/heads/branch-* ]]; then | |
| # echo "DOCKER_REGISTRY=docker.hops.works/hopsworks/trino" >> $GITHUB_ENV | |
| #fi | |
| - name: Build Docker Image | |
| if: github.event_name == 'push' | |
| run: ./core/docker/build.sh -t ${DOCKER_REGISTRY} -x -a amd64 | |
| - name: Login to Docker Registry | |
| if: github.event_name == 'push' | |
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login docker.hops.works -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Push Docker Image | |
| if: github.event_name == 'push' | |
| run: | | |
| # Get version from Maven | |
| VERSION=$(./mvnw -q -DforceStdout help:evaluate -Dexpression=project.version) | |
| IMAGE_TAG="${VERSION}-amd64" | |
| # Push the image built by build.sh | |
| docker push ${DOCKER_REGISTRY}:${IMAGE_TAG} |