-
Notifications
You must be signed in to change notification settings - Fork 145
101 lines (89 loc) · 3.84 KB
/
Copy pathbuild-java.yml
File metadata and controls
101 lines (89 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Build Java Sources
on:
workflow_call:
workflow_dispatch:
env:
# Pin Maven's local repo so it matches the cache path regardless of
# whatever HOME the GHA container runner sets — JVM's user.home reads
# /etc/passwd, not $HOME, and we don't want to rely on that match.
MAVEN_OPTS: -Dmaven.repo.local=/home/ubuntu/.m2/repository
jobs:
build-jar:
name: Build Compiler
runs-on: [gke-runners-amd64]
permissions:
contents: read
env:
# GCS HMAC credentials — feldera-gcs-cache reads these to talk to the
# actions-cache bucket. Scoped to this job: ambient AWS_* credentials
# confuse configure-aws-credentials in upload-jar, which must
# authenticate purely via OIDC.
AWS_ACCESS_KEY_ID: "${{ secrets.CI_GCS_HMAC_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.CI_GCS_HMAC_SECRET_ACCESS_KEY }}"
container:
image: us-central1-docker.pkg.dev/feldera-ci/ghcr-remote/feldera/feldera-dev:sha-e9e4499d6414ba10311bd7ef7cd20816e1d9f5c7
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Cache JVM build dependencies
uses: ./.github/actions/feldera-gcs-cache
with:
path: |
/home/ubuntu/.gradle
/home/ubuntu/.m2/repository
./sql-to-dbsp-compiler/calcite
key: build-java-jvm-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('sql-to-dbsp-compiler/calcite_version.env', 'sql-to-dbsp-compiler/**/pom.xml') }}
restore-keys: |
build-java-jvm-${{ runner.os }}-${{ runner.arch }}-
- name: gradle version
run: |
gradle --version
- name: Build sql2dbsp JARs
run: bash build.sh -pl SQL-compiler
working-directory: ./sql-to-dbsp-compiler
env:
CALCITE_BUILD_DIR: ./calcite
GRADLE_HOME: /home/ubuntu/.gradle
- name: Stop gradle daemon
run: gradle --stop
- name: Copy JAR to artifacts directory
run: |
mkdir -p build-artifacts
cp ./sql-to-dbsp-compiler/SQL-compiler/target/sql2dbsp.jar build-artifacts/
cp ./sql-to-dbsp-compiler/SQL-compiler/target/sql2dbsp-jar-with-dependencies.jar build-artifacts/
- name: Upload build artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: feldera-sql-compiler
path: build-artifacts
retention-days: 7
# S3 upload runs in a separate job so the OIDC session token never enters
# the build-jar environment, where it would poison the cache save phase
# of runs-on/cache (MinIO rejects requests carrying a stray AWS_SESSION_TOKEN).
upload-jar:
name: Upload JAR to S3
needs: build-jar
runs-on: [gke-runners-amd64]
permissions:
id-token: write
contents: read
container:
image: us-central1-docker.pkg.dev/feldera-ci/ghcr-remote/feldera/feldera-dev:sha-e9e4499d6414ba10311bd7ef7cd20816e1d9f5c7
steps:
- name: Download build artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: feldera-sql-compiler
path: build-artifacts
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # v6.2.3
with:
role-to-assume: ${{ vars.SQL2DBSP_UPLOAD_ROLE }}
role-session-name: gha-${{ github.run_id }}
aws-region: ${{ vars.SQL2DBSP_S3_REGION }}
- name: Upload JAR to S3 with SHA in filename
run: |
JAR_FILE=build-artifacts/sql2dbsp-jar-with-dependencies.jar
DEST_NAME=sql2dbsp-jar-with-dependencies-${{ github.sha }}.jar
aws s3 cp "$JAR_FILE" "s3://${{ vars.SQL2DBSP_S3_BUCKET }}/$DEST_NAME" \
--content-type application/java-archive