Skip to content

Commit

Permalink
Change artifact folder structure (#417)
Browse files Browse the repository at this point in the history
* Apply folder structure to build artifacts

* popd not always available

* clean

* Make all builds lowercase (iOS was not)

* Fix formatting

* more consistent naming, and bump version of one action

* explicit names for archives
  • Loading branch information
almarklein authored Sep 5, 2024
1 parent 3e18e3d commit 8c44ec1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 16 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ on:
jobs:

# -----
iOS:
ios:
# Config
name: release - ${{ matrix.name }}
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
include:
- name: iOS-aarch64
- name: ios-aarch64
target: aarch64-apple-ios
- name: iOS-aarch64-simulator
- name: ios-aarch64-simulator
target: aarch64-apple-ios-sim
- name: iOS-x86_64-simulator
- name: ios-x86_64-simulator
target: x86_64-apple-ios
env:
TARGET: ${{ matrix.target }}
Expand All @@ -59,7 +59,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Add iOS targets
- name: Add ios targets
run: rustup target add ${{ matrix.TARGET }}
- name: Setup caching
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -331,12 +331,11 @@ jobs:
name: ${{ env.ARCHIVE_NAME }}

# Create a Github release and upload the binary libs that we just built.
# There should be a release and debug build for each platform (win32, win64, MacOS64, Linux64),
# plus a file containing the commit sha.
# There should be a release and debug build for each platform, plus a file containing the commit sha.
publish:
name: Publish Github release
needs:
- iOS
- ios
- android
- linux
- windows
Expand All @@ -359,7 +358,7 @@ jobs:
run: |
echo $GITHUB_SHA > dist/commit-sha
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.WGPU_NATIVE_VERSION }}
name: ${{ env.WGPU_NATIVE_VERSION }}
Expand Down
42 changes: 35 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,48 @@ endif

package: lib-native lib-native-release
mkdir -p dist
echo "$(GIT_TAG_FULL)" > dist/commit-sha
echo "Zipping the binaries ..."
echo "$(GIT_TAG_FULL)" > dist/wgpu-native-git-tag
for RELEASE in debug release; do \
ARCHIVE=$(ARCHIVE_NAME)-$$RELEASE.zip; \
ARCHIVEDIR=toarchive; \
ARCHIVEFILE=$(ARCHIVE_NAME)-$$RELEASE.zip; \
LIBDIR=$(TARGET_DIR)/$$RELEASE; \
rm -f dist/$$ARCHIVE; \
rm -r -f dist/$$ARCHIVEDIR; \
rm -f dist/$$ARCHIVEFILE; \
mkdir dist/$$ARCHIVEDIR; \
mkdir dist/$$ARCHIVEDIR/include; \
mkdir dist/$$ARCHIVEDIR/lib; \
cp ./dist/wgpu-native-git-tag dist/$$ARCHIVEDIR; \
cp ./ffi/webgpu-headers/webgpu.h dist/$$ARCHIVEDIR/include; \
cp ./ffi/wgpu.h dist/$$ARCHIVEDIR/include; \
if [ $(OS_NAME) = linux ]; then \
cp ./$$LIBDIR/libwgpu_native.so dist/$$ARCHIVEDIR/lib; \
cp ./$$LIBDIR/libwgpu_native.a dist/$$ARCHIVEDIR/lib; \
fi; \
if [ $(OS_NAME) = macos ]; then \
cp ./$$LIBDIR/libwgpu_native.dylib dist/$$ARCHIVEDIR/lib; \
cp ./$$LIBDIR/libwgpu_native.a dist/$$ARCHIVEDIR/lib; \
fi; \
if [ $(OS_NAME) = windows ]; then \
if [[ "$(TARGET)" == *"gnu"* ]]; then \
7z a -tzip dist/$$ARCHIVE ./$$LIBDIR/wgpu_native.dll ./$$LIBDIR/libwgpu_native.dll.a ./$$LIBDIR/libwgpu_native.a ./ffi/webgpu-headers/*.h ./ffi/wgpu.h ./dist/commit-sha; \
cp ./$$LIBDIR/wgpu_native.dll dist/$$ARCHIVEDIR/lib; \
cp ./$$LIBDIR/libwgpu_native.a dist/$$ARCHIVEDIR/lib; \
cp ./$$LIBDIR/libwgpu_native.dll.a dist/$$ARCHIVEDIR/lib; \
else \
7z a -tzip dist/$$ARCHIVE ./$$LIBDIR/wgpu_native.dll ./$$LIBDIR/wgpu_native.dll.lib ./$$LIBDIR/wgpu_native.pdb ./$$LIBDIR/wgpu_native.lib ./ffi/webgpu-headers/*.h ./ffi/wgpu.h ./dist/commit-sha; \
fi; \
cp ./$$LIBDIR/wgpu_native.dll dist/$$ARCHIVEDIR/lib; \
cp ./$$LIBDIR/wgpu_native.lib dist/$$ARCHIVEDIR/lib; \
cp ./$$LIBDIR/wgpu_native.dll.lib dist/$$ARCHIVEDIR/lib; \
cp ./$$LIBDIR/wgpu_native.pdb dist/$$ARCHIVEDIR/lib; \
fi;\
fi; \
cd dist/$$ARCHIVEDIR; \
if [ $(OS_NAME) = windows ]; then \
7z a -tzip ../$$ARCHIVEFILE *; \
else \
zip -j dist/$$ARCHIVE ./$$LIBDIR/libwgpu_native.so ./$$LIBDIR/libwgpu_native.dylib ./$$LIBDIR/libwgpu_native.a ./ffi/webgpu-headers/*.h ./ffi/wgpu.h ./dist/commit-sha; \
zip -r ../$$ARCHIVEFILE *; \
fi; \
cd ../..; \
rm -r -f dist/$$ARCHIVEDIR; \
done

clean:
Expand Down

0 comments on commit 8c44ec1

Please sign in to comment.