Skip to content

Commit 6933b84

Browse files
LucaCanaliPMax5
authored andcommitted
Fix github action build and publish
1 parent 604b7f4 commit 6933b84

File tree

6 files changed

+129
-82
lines changed

6 files changed

+129
-82
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,54 @@
11
name: Tests the build of the extension
22

33
on:
4-
# Triggers the workflow on push or pull request events but only for the master branch
4+
# Run on any PR that targets the master branch
55
pull_request:
66
branches: [ master ]
77

8-
# Allows you to run this workflow manually from the Actions tab
8+
# Allow manual runs from the Actions tab
99
workflow_dispatch:
10-
10+
1111
jobs:
1212
test-build:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
17-
18-
- name: Set environnment package version from tag
19-
run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV # extract "1.2.3" from refs/tags/v1.2.3
20-
21-
- name: Install Python
22-
uses: actions/setup-python@v1
23-
with:
24-
python-version: '3.x'
25-
26-
- name: Install node
27-
uses: actions/setup-node@v4
28-
with:
29-
node-version: '20.x'
30-
31-
- name: Set up JDK 11
32-
uses: actions/setup-java@v4
16+
# 1 – Check out the code
17+
- uses: actions/checkout@v2
18+
19+
# 2 – Expose the version tag as $PACKAGE_VERSION
20+
- name: Set environment package version from tag
21+
run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/v}" >> "$GITHUB_ENV"
22+
23+
# 3 – Set up Python
24+
- uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.x'
27+
28+
# 4 – Set up Node.js
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: '20.x'
32+
33+
# 5 – Set up JDK 11 (adopt) and enable the sbt cache
34+
- name: Set up JDK 11
35+
uses: actions/setup-java@v4
3336
with:
3437
distribution: 'adopt'
3538
java-version: 11
3639
cache: sbt
37-
- uses: sbt/setup-sbt@v1
38-
with:
39-
sbt-runner-version: 1.9.9
4040

41-
- name: Install dependencies
42-
run: pip install build twine
41+
# 6 – Install a recent sbt launcher
42+
- name: Set up sbt
43+
uses: sbt/setup-sbt@v1
44+
with:
45+
sbt-runner-version: 1.9.9
46+
47+
# 7 – Install Python build / publish deps
48+
- name: Install Python dependencies
49+
run: pip install build twine
50+
51+
# 8 – Build the wheel
52+
- name: Build wheel
53+
run: python -m build
4354

44-
- name: Build wheel
45-
run: python -m build

.github/workflows/publish.yml

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,70 @@ name: Publish To PyPI
33
on:
44
push:
55
tags:
6-
- 'v*'
7-
6+
- 'v*' # runs only when you push tags like v1.2.3
7+
88
jobs:
99
build-publish:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
15-
- name: Set environnment package version from tag
16-
run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV # extract "1.2.3" from refs/tags/v1.2.3
17-
18-
- name: Install Python
19-
uses: actions/setup-python@v1
20-
with:
21-
python-version: '3.x'
22-
23-
- name: Install node
24-
uses: actions/setup-node@v4
25-
with:
26-
node-version: '20.x'
27-
28-
- name: Set up JDK 11
29-
uses: actions/setup-java@v4
13+
# 1 – Check out the repo
14+
- uses: actions/checkout@v2
15+
16+
# 2 – Expose the tag (e.g. 1.2.3) as $PACKAGE_VERSION
17+
- name: Set environment package version from tag
18+
run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/v}" >> "$GITHUB_ENV"
19+
20+
# 3 – Set up Python
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.x'
24+
25+
# 4 – Set up Node.js
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: '20.x'
29+
30+
# 5 – Set up JDK 11 (adopt) and enable sbt cache
31+
- name: Set up JDK 11
32+
uses: actions/setup-java@v4
3033
with:
3134
distribution: 'adopt'
32-
java-version: 11
33-
cache: sbt
34-
- uses: sbt/setup-sbt@v1
35-
with:
36-
sbt-runner-version: 1.9.9
37-
38-
- name: Install dependencies
39-
run: pip install build twine
40-
41-
- name: Build wheel
42-
run: python -m build
43-
44-
- name: Publish distribution to PyPI
45-
env:
46-
TWINE_USERNAME: __token__
47-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
48-
run: twine upload --repository pypi dist/*
49-
50-
- name: Invoke workflow in systemuser-image
51-
uses: benc-uk/workflow-dispatch@v1
52-
with:
53-
workflow: SWAN CI/CD pipeline
54-
ref: master
55-
repo: swan-cern/systemuser-image
56-
token: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
57-
inputs: '{ "package": "sparkmonitor", "version": "${{env.PACKAGE_VERSION}}" }'
35+
java-version: '11'
36+
cache: 'sbt'
37+
38+
# 6 – Install the sbt launcher
39+
- name: Set up sbt
40+
uses: sbt/setup-sbt@v1
41+
with:
42+
sbt-runner-version: '1.9.9'
43+
44+
# 7 – Install Python build & upload deps
45+
- name: Install Python dependencies
46+
run: pip install build twine
47+
48+
# 8 – Build the wheel/sdist
49+
- name: Build distribution
50+
run: python -m build
51+
52+
# 9 – Upload to PyPI
53+
- name: Publish distribution to PyPI
54+
env:
55+
TWINE_USERNAME: __token__
56+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
57+
run: twine upload --repository pypi dist/*
58+
59+
# 10 – Trigger downstream workflow
60+
- name: Invoke workflow in systemuser-image
61+
uses: benc-uk/workflow-dispatch@v1
62+
with:
63+
workflow: SWAN CI/CD pipeline
64+
ref: master
65+
repo: swan-cern/systemuser-image
66+
token: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
67+
inputs: |
68+
{
69+
"package": "sparkmonitor",
70+
"version": "${{ env.PACKAGE_VERSION }}"
71+
}
72+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ node_modules/
1010
*.tsbuildinfo
1111
sparkmonitor/labextension
1212
sparkmonitor/nbextension
13-
scalalistener/project/
13+
scalalistener/project/project
14+
scalalistener/project/target
1415
scalalistener/target/
1516
sparkmonitor/*.jar
1617
# Version file is handled by hatchling

scalalistener/build.sbt

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
1-
name := "sparkmonitor"
1+
import sbtassembly.AssemblyPlugin.autoImport._ // single, unambiguous import
2+
3+
/***********************
4+
* project settings *
5+
***********************/
6+
organization := "CERN"
7+
version := "1.1"
8+
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))
29

3-
version := "1.1"
10+
name := "sparkmonitor"
411

5-
scalaVersion := "2.12.18"
6-
crossScalaVersions := Seq("2.12.18", "2.13.8")
7-
organization := "cern"
8-
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
12+
scalaVersion := "2.12.18"
13+
crossScalaVersions := Seq("2.12.18", "2.13.8")
914

10-
libraryDependencies += "org.apache.spark" %% "spark-sql" % "3.5.5"
15+
/***************************************
16+
* runtime / compile dependencies *
17+
***************************************/
18+
libraryDependencies ++= Seq(
19+
"org.apache.spark" %% "spark-core" % "3.5.5" % Provided,
20+
"org.apache.spark" %% "spark-sql" % "3.5.5" % Provided
21+
)
1122

23+
/*****************************************************************
24+
* 1. where the **thin** JAR from `package` should be written *
25+
*****************************************************************/
1226
Compile / packageBin / artifactPath := {
13-
val scalaBin = CrossVersion.binaryScalaVersion(scalaVersion.value)
14-
file(s"../sparkmonitor/listener_$scalaBin.jar")
27+
val bin = CrossVersion.binaryScalaVersion(scalaVersion.value)
28+
baseDirectory.value / ".." / "sparkmonitor" / s"listener_$bin.jar"
1529
}
30+
31+
/*****************************************************************
32+
* 2. where the **fat** JAR from `assembly` should be written *
33+
*****************************************************************/
34+
assembly / assemblyOutputPath := (Compile / packageBin / artifactPath).value
35+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.9.3

scalalistener/project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.4")

0 commit comments

Comments
 (0)