Move Test over #586
Workflow file for this run
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: Build uber jar | |
on: | |
release: | |
types: [created] | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
uber-jar: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
strategy: | |
matrix: | |
FLINK_PROFILE: [flink-1.19] | |
env: | |
VERSION: ${{ github.event_name == 'release' && github.event.action == 'created' && github.ref_name || '1.0.0-SNAPSHOT' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Generate settings.xml | |
run: | | |
mkdir -p ~/.m2 | |
echo "<settings> | |
<servers> | |
<server> | |
<id>github</id> | |
<username>${{ github.actor }}</username> | |
<password>${{ secrets.GITHUB_TOKEN }}</password> | |
</server> | |
</servers> | |
</settings>" > ~/.m2/settings.xml | |
- name: Download dependencies | |
run: | | |
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline de.qaware.maven:go-offline-maven-plugin:1.2.8:resolve-dependencies -P${{ matrix.FLINK_PROFILE }} | |
mvn -B -f flink-sql-runner/pom.xml org.apache.maven.plugins:maven-resources-plugin:3.3.1:resources -P${{ matrix.FLINK_PROFILE }} | |
docker pull postgres:17 | |
grep '^FROM' flink-sql-runner/target/Dockerfile | awk '{print $2}' | xargs -n1 docker pull | |
- name: Update version | |
if: github.event_name == 'release' && github.event.action == 'created' | |
run: | | |
mvn -B versions:set -DnewVersion=${{ env.VERSION }} | |
- name: Run Maven Build | |
run: | | |
mvn -B clean install -P${{ matrix.FLINK_PROFILE }} | |
- name: Define Docker image tag | |
id: vars | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
echo "image_tag=ghcr.io/datasqrl/flink-sql-runner:pr-${{ github.event.number }}-${{ matrix.FLINK_PROFILE }}" >> $GITHUB_OUTPUT | |
else | |
echo "image_tag=datasqrl/flink-sql-runner:${{ env.VERSION }}-${{ matrix.FLINK_PROFILE }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Log in to container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ github.event_name == 'pull_request' && 'ghcr.io' || 'docker.io' }} | |
username: ${{ github.event_name == 'pull_request' && github.actor || secrets.DOCKER_USERNAME }} | |
password: ${{ github.event_name == 'pull_request' && secrets.GITHUB_TOKEN || secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image (linux/amd64 + linux/arm64) | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./flink-sql-runner/target | |
file: ./flink-sql-runner/target/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.vars.outputs.image_tag }} | |
- name: Rename jar file | |
if: github.event_name == 'release' && github.event.action == 'created' | |
run: | | |
mv flink-sql-runner/target/flink-sql-runner.uber.jar flink-sql-runner/target/flink-sql-runner-${{ env.VERSION }}-${{ matrix.FLINK_PROFILE }}.jar | |
- name: Upload to GitHub Release | |
if: github.event_name == 'release' && github.event.action == 'created' | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: flink-sql-runner/target/flink-sql-runner-${{ env.VERSION }}-${{ matrix.FLINK_PROFILE }}.jar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |