-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathbuild_with_scala_and_python_tests.yml
More file actions
112 lines (93 loc) · 3.08 KB
/
build_with_scala_and_python_tests.yml
File metadata and controls
112 lines (93 loc) · 3.08 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
102
103
104
105
106
107
108
109
110
111
112
name: sparkMeasure CI
on:
push:
pull_request:
branches: [ master ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
scala:
name: Scala build & test (Java ${{ matrix.java-version }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
java-version: [ 11, 17 ]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup JDK ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
cache: sbt
- name: Setup sbt 1.12.4
uses: sbt/setup-sbt@v1
with:
sbt-runner-version: 1.12.4
- name: Show tool versions
run: |
java -version
sbt --version
- name: Compile & test (all cross Scala versions)
run: sbt -v +test
- name: Package (all cross Scala versions)
run: sbt -v +package
- name: Upload jars (from Java 17 only)
if: matrix.java-version == 17
uses: actions/upload-artifact@v4
with:
name: sparkMeasure-jars
path: |
**/target/scala-2.12/*.jar
**/target/scala-2.13/*.jar
if-no-files-found: error
python:
name: Python tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-24.04
needs: scala
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.13" ]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Download sparkMeasure jars
uses: actions/download-artifact@v4
with:
name: sparkMeasure-jars
path: _sparkmeasure_jars
- name: Place Scala 2.12 jar where python tests expect it
run: |
mkdir -p target/scala-2.12
# Copy any sparkMeasure Scala 2.12 jar into the expected folder
find _sparkmeasure_jars -type f -path "*/scala-2.12/*.jar" -name "spark-measure_*.jar" -exec cp -v {} target/scala-2.12/ \;
echo "Contents of target/scala-2.12:"
ls -lah target/scala-2.12
# Fail fast with a clear message if nothing was copied
test -n "$(ls -1 target/scala-2.12/spark-measure_*.jar 2>/dev/null | head -n 1)" || (echo "No spark-measure_*.jar found for Scala 2.12 after download/copy." && exit 1)
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: python/requirements.txt
# Keep Java if Python tests use PySpark
- name: Setup JDK 17 (for PySpark tests)
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
- name: Install Python dependencies
working-directory: python
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pytest
run: pytest -q python/sparkmeasure