-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update CI to publish binary releases on git version tag #27
Changes from 2 commits
0e9b5c8
4b9e848
a0dce9f
ed5ee3b
10f5f05
28dbffc
7474790
e39b44d
0c001bd
60f5080
e28df46
63999b4
464eb8b
aaffae5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,20 +9,30 @@ on: | |
branches-ignore: [ staging.tmp ] | ||
|
||
jobs: | ||
build: | ||
|
||
# Prepare a file containing the commit sha, to be included in the releases | ||
prepare: | ||
name: Prepare for builds | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Create commit-sha file | ||
env: | ||
GITHUB_SHA: ${{ github.sha }} | ||
run: | | ||
echo $GITHUB_SHA > commit-sha | ||
- name: Publish commit-sha | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: commit-sha | ||
name: dist | ||
|
||
# Builds to test that the package can be build on various platforms | ||
test-build: | ||
name: ${{ matrix.name }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
name: [ | ||
MacOS Stable, | ||
MacOS Nightly, | ||
Ubuntu Stable, | ||
Ubuntu Nightly, | ||
Windows Stable, | ||
Windows Nightly | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed this, as it's not needed, I believe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out this was here for bors, see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it though? The jobs still have the same names. I don't think Bors checks this file or anything, it just listens for success/fail events with matching names, so I think it's fine. Unless I'm missing something. |
||
include: | ||
- os: macos-10.15 | ||
name: MacOS Stable | ||
|
@@ -96,43 +106,97 @@ jobs: | |
run: cargo +nightly install cbindgen | ||
- run: ${{ matrix.make_command }} | ||
shell: bash | ||
- if: matrix.channel == 'stable' && contains(github.ref, 'tags/v') | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist/wgpu-*.zip | ||
|
||
publish: | ||
if: contains(github.ref, 'tags/v') | ||
needs: [build] | ||
name: Publish release artifacts | ||
runs-on: ubuntu-18.04 | ||
# Builds for binary releases. | ||
# Also build on non-tag commits; it also functions as a test. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have an idea of how much slower this would make our general CI? I.e. does using an image affect the build times? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd slightly prefer to only bother building tagged commits to avoid the potential for CI backlog, but we could start with this and see how it goes |
||
# The Linux builds are performed on a "manylinux2010" container. This container | ||
# is designed such that that the resulting binary has minimal dependencies on system | ||
# libraries, and thus works on as many linuxes as possible. It's a thing from the | ||
# Python world, but generally useful. | ||
release-build: | ||
needs: prepare | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- name: Linux-64 | ||
os: ubuntu-18.04 | ||
RUST_TOOLCHAIN: stable | ||
ARCH: 64 | ||
OS_NAME: linux | ||
IMAGE: manylinux2010_x86_64 | ||
- name: Linux-32 | ||
os: ubuntu-18.04 | ||
RUST_TOOLCHAIN: stable-i686-unknown-linux-gnu | ||
ARCH: 32 | ||
OS_NAME: linux | ||
IMAGE: manylinux2010_i686 | ||
- name: MacOS-64 | ||
os: macOS-10.14 | ||
RUST_TOOLCHAIN: stable | ||
ARCH: 64 | ||
OS_NAME: macos | ||
MACOSX_DEPLOYMENT_TARGET: '10.13' | ||
- name: Windows-64 | ||
os: vs2017-win2016 | ||
RUST_TOOLCHAIN: stable-msvc | ||
ARCH: 64 | ||
OS_NAME: windows | ||
- name: Windows-32 | ||
os: vs2017-win2016 | ||
RUST_TOOLCHAIN: stable-i686-pc-windows-msvc | ||
ARCH: 32 | ||
OS_NAME: windows | ||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: $GITHUB_WORKSPACE/wgpu-release/ | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
# TODO | ||
body: | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
# Move back to official action after fix https://github.com/actions/upload-release-asset/issues/4 | ||
uses: csexton/release-asset-action@v2 | ||
with: | ||
pattern: "$GITHUB_WORKSPACE/wgpu-release/*.zip" | ||
release-url: ${{ steps.create_release.outputs.upload_url }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
- name: Docker build | ||
if: success() && matrix.OS_NAME == 'Linux' | ||
env: | ||
IMAGE: ${{ matrix.IMAGE }} | ||
RUST_TOOLCHAIN: ${{ matrix.RUST_TOOLCHAIN }} | ||
run: | | ||
CID=$(docker create -t -w /tmp/wgpu-native -v $PWD:/tmp/src:ro quay.io/pypa/$IMAGE bash -c "\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you need to preface all of the bash scripts with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that's fine then |
||
cp -r /tmp/src/. . && \ | ||
rm -rf ./dist && \ | ||
export PATH=/root/.cargo/bin:\$PATH && \ | ||
export USER=root && \ | ||
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && \ | ||
rustup toolchain install --no-self-update $RUST_TOOLCHAIN && \ | ||
rustup default $RUST_TOOLCHAIN && \ | ||
yum install zip -y && \ | ||
make package") | ||
docker start -ai $CID | ||
mkdir -p dist | ||
docker cp $CID:/tmp/wgpu-native/dist/. dist/. | ||
docker rm $CID | ||
- name: Host build | ||
if: success() && matrix.OS_NAME != 'Linux' | ||
env: | ||
RUST_TOOLCHAIN: ${{ matrix.RUST_TOOLCHAIN }} | ||
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.MACOSX_DEPLOYMENT_TARGET }} | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain none | ||
export PATH=$HOME/.cargo/bin:$PATH | ||
rustup toolchain install --no-self-update $RUST_TOOLCHAIN | ||
rustup default $RUST_TOOLCHAIN | ||
make package | ||
shell: bash | ||
- name: Pre-publish | ||
env: | ||
OS_NAME: ${{ matrix.OS_NAME }} | ||
ARCH: ${{ matrix.ARCH }} | ||
run: | | ||
mkdir -p ./dist | ||
mv dist/*debug*.zip ./dist/wgpu-$OS_NAME-$ARCH-debug.zip | ||
mv dist/*release*.zip ./dist/wgpu-$OS_NAME-$ARCH-release.zip | ||
shell: bash | ||
- name: Publish | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: dist | ||
name: dist | ||
|
||
# Some smaller test builds | ||
|
||
ios-build: | ||
name: iOS Stable | ||
|
@@ -166,3 +230,35 @@ jobs: | |
- uses: actions/checkout@v2 | ||
- run: rustup component add clippy | ||
- run: cargo clippy --features vulkan-portability | ||
|
||
# Create a Github release and upload the binary libs that we just built. | ||
# There should be a release and debug build for each os (win32, win64, MacOS, Linux), | ||
# plus a file containing the commit sha. | ||
publish: | ||
needs: [release-build] | ||
runs-on: ubuntu-18.04 | ||
if: success() && github.event_name == 'tag' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Download assets | ||
uses: actions/[email protected] | ||
with: | ||
name: dist | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
Autogenerated binary modules. | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Assets | ||
# Move back to official action after fix https://github.com/actions/upload-release-asset/issues/4 | ||
uses: AButler/[email protected] | ||
with: | ||
release-tag: ${{ github.ref }} | ||
files: 'dist/*.zip;dist/commit-sha' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike wgpu-bin where we have to clone the source repo prior to building, here you can just create the commit-sha file in the final
publish
job and avoid theprepare
job completely. It will allow queueing the subsequent jobs earlierThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd assumed the build needed it, but
make package
already does that. We can thus omit this step completely, because the GH release page already reports the commit sha :)