Skip to content

Commit 477c8a4

Browse files
authored
build: lint as a separate step (#3717)
1 parent a1a82fd commit 477c8a4

2 files changed

Lines changed: 69 additions & 33 deletions

File tree

.github/actions/java-test/action.yaml

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ runs:
5959
# temporarily work around https://github.com/actions/runner-images/issues/13341
6060
# by disabling caching for macOS
6161
if: ${{ runner.os != 'macOS' }}
62-
uses: actions/cache@v4
62+
uses: actions/cache@v5
6363
with:
6464
path: |
6565
~/.m2/repository
@@ -68,36 +68,6 @@ runs:
6868
restore-keys: |
6969
${{ runner.os }}-java-maven-
7070
71-
- name: Run Maven compile
72-
shell: bash
73-
run: |
74-
./mvnw -B package -DskipTests scalafix:scalafix -Dscalafix.mode=CHECK -Psemanticdb ${{ inputs.maven_opts }}
75-
76-
- name: Setup Node.js
77-
uses: actions/setup-node@v6
78-
with:
79-
node-version: '24'
80-
81-
- name: Install prettier
82-
shell: bash
83-
run: |
84-
npm install -g prettier
85-
86-
- name: Run prettier
87-
shell: bash
88-
run: |
89-
npx prettier "**/*.md" --write
90-
91-
- name: Mark workspace as safe for git
92-
shell: bash
93-
run: |
94-
git config --global --add safe.directory "$GITHUB_WORKSPACE"
95-
96-
- name: Check for any local git changes (such as generated docs)
97-
shell: bash
98-
run: |
99-
./dev/ci/check-working-tree-clean.sh
100-
10171
- name: Run all tests
10272
shell: bash
10373
if: ${{ inputs.suites == '' }}
@@ -106,7 +76,7 @@ runs:
10676
SPARK_LOCAL_HOSTNAME: "localhost"
10777
SPARK_LOCAL_IP: "127.0.0.1"
10878
run: |
109-
MAVEN_OPTS="-Xmx4G -Xms2G -XX:+UnlockDiagnosticVMOptions -XX:+ShowMessageBoxOnError -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=./hs_err_pid%p.log" SPARK_HOME=`pwd` ./mvnw -B -Prelease clean install ${{ inputs.maven_opts }}
79+
MAVEN_OPTS="-Xmx4G -Xms2G -XX:+UnlockDiagnosticVMOptions -XX:+ShowMessageBoxOnError -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=./hs_err_pid%p.log" SPARK_HOME=`pwd` ./mvnw -B -Prelease install ${{ inputs.maven_opts }}
11080
- name: Run specified tests
11181
shell: bash
11282
if: ${{ inputs.suites != '' }}
@@ -117,7 +87,7 @@ runs:
11787
run: |
11888
MAVEN_SUITES="$(echo "${{ inputs.suites }}" | paste -sd, -)"
11989
echo "Running with MAVEN_SUITES=$MAVEN_SUITES"
120-
MAVEN_OPTS="-Xmx4G -Xms2G -DwildcardSuites=$MAVEN_SUITES -XX:+UnlockDiagnosticVMOptions -XX:+ShowMessageBoxOnError -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=./hs_err_pid%p.log" SPARK_HOME=`pwd` ./mvnw -B -Prelease clean install ${{ inputs.maven_opts }}
90+
MAVEN_OPTS="-Xmx4G -Xms2G -DwildcardSuites=$MAVEN_SUITES -XX:+UnlockDiagnosticVMOptions -XX:+ShowMessageBoxOnError -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=./hs_err_pid%p.log" SPARK_HOME=`pwd` ./mvnw -B -Prelease install ${{ inputs.maven_opts }}
12191
- name: Upload crash logs
12292
if: failure()
12393
uses: actions/upload-artifact@v6

.github/workflows/pr_build_linux.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,72 @@ jobs:
6666
rustup component add rustfmt
6767
cd native && cargo fmt --all -- --check
6868
69+
lint-java:
70+
needs: lint
71+
name: Lint Java (${{ matrix.profile.name }})
72+
runs-on: ubuntu-latest
73+
container:
74+
image: amd64/rust
75+
env:
76+
JAVA_TOOL_OPTIONS: ${{ matrix.profile.java_version == '17' && '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.util.calendar=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED' || '' }}
77+
strategy:
78+
matrix:
79+
profile:
80+
- name: "Spark 3.4, JDK 11, Scala 2.12"
81+
java_version: "11"
82+
maven_opts: "-Pspark-3.4 -Pscala-2.12"
83+
- name: "Spark 3.5, JDK 17, Scala 2.12"
84+
java_version: "17"
85+
maven_opts: "-Pspark-3.5 -Pscala-2.12"
86+
- name: "Spark 4.0, JDK 17"
87+
java_version: "17"
88+
maven_opts: "-Pspark-4.0"
89+
fail-fast: false
90+
steps:
91+
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # v2.0.3
92+
- uses: actions/checkout@v6
93+
94+
- name: Setup Rust & Java toolchain
95+
uses: ./.github/actions/setup-builder
96+
with:
97+
rust-version: ${{ env.RUST_VERSION }}
98+
jdk-version: ${{ matrix.profile.java_version }}
99+
100+
- name: Cache Maven dependencies
101+
uses: actions/cache@v5
102+
with:
103+
path: |
104+
~/.m2/repository
105+
/root/.m2/repository
106+
key: ${{ runner.os }}-java-maven-${{ hashFiles('**/pom.xml') }}-lint
107+
restore-keys: |
108+
${{ runner.os }}-java-maven-
109+
110+
- name: Run scalafix check
111+
run: |
112+
./mvnw -B package -DskipTests scalafix:scalafix -Dscalafix.mode=CHECK -Psemanticdb ${{ matrix.profile.maven_opts }}
113+
114+
- name: Setup Node.js
115+
uses: actions/setup-node@v6
116+
with:
117+
node-version: '24'
118+
119+
- name: Install prettier
120+
run: |
121+
npm install -g prettier
122+
123+
- name: Run prettier
124+
run: |
125+
npx prettier "**/*.md" --write
126+
127+
- name: Mark workspace as safe for git
128+
run: |
129+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
130+
131+
- name: Check for any local git changes (such as generated docs)
132+
run: |
133+
./dev/ci/check-working-tree-clean.sh
134+
69135
# Build native library once and share with all test jobs
70136
build-native:
71137
needs: lint

0 commit comments

Comments
 (0)