@@ -2,74 +2,57 @@ name: Core CI & Release
22
33on :
44 push :
5- branches :
6- - main
7- tags :
8- - ' v*'
5+ branches : [main]
6+ tags : ['v*']
97 pull_request :
10- branches :
11- - main
8+ branches : [main]
129
1310jobs :
14- # --- STAGE 0: Version Verification (Tags Only) ---
1511 verify-version :
1612 name : Verify Version Match
1713 if : startsWith(github.ref, 'refs/tags/v')
1814 runs-on : ubuntu-latest
1915 steps :
20- - name : Checkout Code
21- uses : actions/checkout@v4
22-
23- - name : Compare Tag to VERSION file
24- run : |
16+ - uses : actions/checkout@v4
17+ - run : |
2518 TAG_VERSION=${GITHUB_REF_NAME#v}
2619 FILE_VERSION=$(cat VERSION)
2720 if [[ "$TAG_VERSION" != "$FILE_VERSION"* ]]; then
28- echo "::error::Version Mismatch! Tag '$TAG_VERSION' must start with '$FILE_VERSION'"
21+ echo "::error::Version Mismatch! Tag '$TAG_VERSION' vs VERSION '$FILE_VERSION'"
2922 exit 1
3023 fi
3124
32- # --- STAGE 1: Build WASM Core ---
3325 build-core :
3426 name : Build WASM Core
3527 runs-on : ubuntu-latest
3628 steps :
37- - name : Checkout Code
38- uses : actions/checkout@v4
39-
40- - name : Cache Emscripten SDK
29+ - uses : actions/checkout@v4
30+ - name : Cache Emscripten
4131 id : cache-emsdk
4232 uses : actions/cache@v4
4333 with :
4434 path : emsdk
4535 key : ${{ runner.os }}-emsdk-4.0.10
46-
47- - name : Install Emscripten (if not cached)
36+ - name : Install Emscripten
4837 if : steps.cache-emsdk.outputs.cache-hit != 'true'
4938 run : |
5039 git clone https://github.com/emscripten-core/emsdk.git
5140 cd emsdk && ./emsdk install 4.0.10 && ./emsdk activate 4.0.10
52-
53- - name : Compile WASM
41+ - name : Compile
5442 run : |
5543 source emsdk/emsdk_env.sh
5644 make wasm
57-
58- - name : Upload Python WASM Artifacts
45+ - name : Upload Python Artifacts
5946 uses : actions/upload-artifact@v4
6047 with :
6148 name : python-wasm-binaries
6249 path : j2735codec/bindings/python/src/j2735codec/generated/
63- retention-days : 1
64-
65- - name : Upload Node WASM Artifacts
50+ - name : Upload Node Artifacts
6651 uses : actions/upload-artifact@v4
6752 with :
6853 name : node-wasm-binaries
6954 path : j2735codec/bindings/node/src/generated/
70- retention-days : 1
7155
72- # --- STAGE 2: Test Bindings ---
7356 test-bindings :
7457 name : Test ${{ matrix.binding }}
7558 needs : build-core
@@ -78,50 +61,20 @@ jobs:
7861 fail-fast : false
7962 matrix :
8063 binding : [python, node]
81-
8264 steps :
83- - name : Checkout Code
84- uses : actions/checkout@v4
85-
86- - name : Download Artifacts
87- uses : actions/download-artifact@v4
65+ - uses : actions/checkout@v4
66+ - uses : actions/download-artifact@v4
8867 with :
8968 name : ${{ matrix.binding }}-wasm-binaries
9069 path : j2735codec/bindings/${{ matrix.binding }}/${{ matrix.binding == 'python' && 'src/j2735codec/generated/' || 'src/generated/' }}
91-
92- # Python Tests
93- - name : Setup uv
94- if : matrix.binding == 'python'
95- uses : astral-sh/setup-uv@v5
96- with :
97- enable-cache : true
98-
99- - name : Python Test Suite
100- if : matrix.binding == 'python'
70+ - name : Setup & Test
10171 run : |
102- cd j2735codec/bindings/python
103- uv sync
104- uv run pytest tests/ -s
105- env :
106- PYTHONPATH : src
107-
108- # Node.js Tests
109- - name : Setup Node.js
110- if : matrix.binding == 'node'
111- uses : actions/setup-node@v4
112- with :
113- node-version-file : ' j2735codec/bindings/node/.nvmrc'
114- cache : ' npm'
115- cache-dependency-path : ' package-lock.json'
116-
117- - name : Node Test Suite
118- if : matrix.binding == 'node'
119- run : |
120- npm install
121- npm run build -w j2735codec
122- npm test -w j2735codec
72+ if [ "${{ matrix.binding }}" == "python" ]; then
73+ pip install uv && cd j2735codec/bindings/python && uv sync && uv run pytest
74+ else
75+ npm install && npm run build -w j2735codec && npm test -w j2735codec
76+ fi
12377
124- # --- STAGE 3: Unified Release (Tags Only) ---
12578 publish-release :
12679 name : Publish Release
12780 needs : [verify-version, test-bindings]
@@ -130,50 +83,63 @@ jobs:
13083 permissions :
13184 contents : write
13285 steps :
133- - name : Checkout Code
134- uses : actions/checkout@v4
135-
86+ - uses : actions/checkout@v4
87+
13688 - name : Download Artifacts
13789 uses : actions/download-artifact@v4
13890 with :
13991 path : artifacts
14092
141- - name : Build Python Release
93+ - name : Build & Stage Assets
14294 run : |
143- mkdir -p j2735codec/bindings/python/src/j2735codec/generated/
144- cp -R artifacts/python-wasm-binaries/* j2735codec/bindings/python/src/j2735codec/generated/
145- cp LICENSE NOTICE j2735codec/bindings/python/
95+ # 1. Create a clean staging area at the ROOT
96+ STAGING="$GITHUB_WORKSPACE/dist_release"
97+ mkdir -p $STAGING
98+
99+ # 2. Build Python
100+ PY_DIR="$GITHUB_WORKSPACE/j2735codec/bindings/python"
101+ mkdir -p $PY_DIR/src/j2735codec/generated/
102+ cp -R artifacts/python-wasm-binaries/* $PY_DIR/src/j2735codec/generated/
146103 pip install uv
147- cd j2735codec/bindings/python && uv build
148-
149- - name : Build Node Release
150- run : |
151- mkdir -p j2735codec/bindings/node/src/generated/
152- cp -R artifacts/node-wasm-binaries/* j2735codec/bindings/node/src/generated/
153- cp LICENSE NOTICE j2735codec/bindings/node/
154- # Build and Pack
104+ cd $PY_DIR && uv build --out-dir ./dist_local
105+
106+ # Use find to move and prefix files safely
107+ find ./dist_local -type f -exec bash -c 'cp "$1" "'$STAGING'/python-$(basename "$1")"' _ {} \;
108+
109+ # 3. Build Node
110+ cd $GITHUB_WORKSPACE
111+ JS_DIR="$GITHUB_WORKSPACE/j2735codec/bindings/node"
112+ mkdir -p $JS_DIR/src/generated/
113+ cp -R artifacts/node-wasm-binaries/* $JS_DIR/src/generated/
155114 npm install
156115 npm run build -w j2735codec
157- cd j2735codec/bindings/node && npm pack
116+ cd $JS_DIR && npm pack
117+
118+ # Move and prefix node tarball
119+ find . -maxdepth 1 -name "*.tgz" -exec bash -c 'cp "$1" "'$STAGING'/node-$(basename "$1")"' _ {} \;
120+
121+ # 4. Grab Raw WASM Binary
122+ cp $GITHUB_WORKSPACE/artifacts/python-wasm-binaries/j2735codec.wasm $STAGING/j2735codec.wasm
123+
124+ # 5. Legal
125+ cp $GITHUB_WORKSPACE/LICENSE $STAGING/
126+ cp $GITHUB_WORKSPACE/NOTICE $STAGING/
127+
128+ - name : Verify Staging Contents
129+ run : |
130+ echo "Listing files to be uploaded:"
131+ ls -lh dist_release/
132+ if [ $(ls dist_release/ | wc -l) -eq 0 ]; then echo "EMPTY STAGING FOLDER" && exit 1; fi
158133
159134 - name : Create GitHub Release
160135 uses : softprops/action-gh-release@v2
161136 with :
162137 name : " Release ${{ github.ref_name }}"
163138 body : |
164139 ## J2735 Codec Release ${{ github.ref_name }}
165-
166- ### Included Artifacts
167- - Python Wheel and Source Dist
168- - Node.js Tarball
169-
170- ---
171- *Licensed under Apache-2.0. See LICENSE and NOTICE files in packages.*
140+ - **python-***: Python Wheel & Source Dist
141+ - **node-***: Node.js Tarball
142+ - **j2735codec.wasm**: Standalone WASM engine
172143 prerelease : ${{ contains(github.ref_name, 'test') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }}
173- files : |
174- j2735codec/bindings/python/dist/*.whl
175- j2735codec/bindings/python/dist/*.tar.gz
176- j2735codec/bindings/node/*.tgz
177- LICENSE
178- NOTICE
144+ files : dist_release/*
179145 generate_release_notes : true
0 commit comments