Skip to content

Commit

Permalink
Revamp the release process
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed May 10, 2024
1 parent 983dde1 commit 98b8d24
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 77 deletions.
182 changes: 113 additions & 69 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,95 +6,138 @@ on:
- "*"

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
target_alias: linux-x86_64
bin_suffix: ''
archive_suffix: '.tar.bz2'
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
target_alias: linux-aarch64
bin_suffix: ''
archive_suffix: '.tar.bz2'
- os: windows-latest
target: x86_64-pc-windows-msvc
target_alias: win-x86_64
bin_suffix: '.exe'
archive_suffix: '.zip'
- os: windows-latest
target: aarch64-pc-windows-msvc
target_alias: win-aarch64
bin_suffix: '.exe'
archive_suffix: '.zip'
- os: macos-latest
target: aarch64-apple-darwin
target_alias: macos-aarch64
bin_suffix: ''
archive_suffix: '.zip'
defaults:
run:
shell: bash
env:
ARCHIVE_PATH: wasi-update_${{ github.ref_name }}_${{ matrix.target_alias }}${{ matrix.archive_suffix }}
builds-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- uses: hecrj/setup-rust-action@v2
with:
rust-version: stable

- run: |
rustup target add wasm32-unknown-unknown
rustup target add x86_64-pc-windows-msvc
make clean-app
make CARGO_FLAGS="--target x86_64-pc-windows-msvc"
install -d wasi-update
install bin/wasi-update* wasi-update/
7z a -mx=9 wasi-update_${{ github.ref_name }}_windows-x86_64.zip wasi-update
rustup target add aarch64-pc-windows-msvc
make clean-app
make CARGO_FLAGS="--target aarch64-pc-windows-msvc"
install -d wasi-update
install bin/wasi-update* wasi-update/
7z a -mx=9 wasi-update_${{ github.ref_name }}_windows-aarch64.zip wasi-update
- uses: actions/upload-artifact@v4
with:
name: wasi-update-win-x86_64
path: wasi-update_${{ github.ref_name }}_windows-x86_64.zip

- uses: actions/upload-artifact@v4
with:
name: wasi-update-win-aarch64
path: wasi-update_${{ github.ref_name }}_windows-aarch64.zip

build-on-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: hecrj/setup-rust-action@v2
with:
rust-version: stable

- run: |
rustup target add aarch64-apple-darwin
make CARGO_FLAGS="--target aarch64-apple-darwin"
install -d wasi-update
install bin/wasi-update* wasi-update/
tar cjpf wasi-update_${{ github.ref_name }}_macos-aarch64.tar.bz2 wasi-update
- uses: actions/upload-artifact@v4
with:
name: wasi-update-macos-aarch64
path: wasi-update_${{ github.ref_name }}_macos-aarch64.tar.bz2

build-on-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- name: Install Zig
uses: goto-bus-stop/setup-zig@2a9625d550eefc3a9b1a43d342ad655f563f8241
with:
version: 0.12.0

- uses: hecrj/setup-rust-action@v2
with:
rust-version: stable
targets: ${{ matrix.target }}

- name: Check Cargo availability
run: cargo --version
- run: |
cargo install cargo-zigbuild
- name: Check Rustup default toolchain
run: rustup default | grep stable
rustup target add wasm32-unknown-unknown
cargo install cargo-deb
- name: Build
run: |
make
( cd src && cargo deb --output=../wasi-update_${{ github.ref_name }}_amd64.deb --no-build )
rustup target add x86_64-unknown-linux-gnu
make clean-app
make CARGO_FLAGS="--target x86_64-unknown-linux-gnu"
install -d wasi-update
install bin/wasi-update* wasi-update/
if [ "${{ matrix.os }}" = "ubuntu-20.04" ]; then
tar cjpf ${ARCHIVE_PATH} wasi-update
elif [ "${{ matrix.os }}" = "windows-latest" ]; then
"/C/Program Files/7-Zip/7z" a ${ARCHIVE_PATH} wasi-update
fi
- name: Install cargo-deb and build Debian package
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
cargo install cargo-deb
cd src && cargo deb --output=../wasi-update_${{ github.ref_name }}_amd64.deb --no-build
tar cjpf wasi-update_${{ github.ref_name }}_linux-x86_64.tar.bz2 wasi-update
rustup target add aarch64-unknown-linux-gnu
make clean-app
make CARGO_FLAGS="--target aarch64-unknown-linux-gnu"
install -d wasi-update
install bin/wasi-update* wasi-update/
tar cjpf wasi-update_${{ github.ref_name }}_linux-aarch64.tar.bz2 wasi-update
rustup target add wasm32-wasi
make clean-app
make CARGO_FLAGS="--target wasm32-wasi"
install -d wasi-update
install bin/wasi-update* wasi-update/
tar cjpf wasi-update_${{ github.ref_name }}_wasm32-wasi.tar.bz2 wasi-update
- uses: actions/upload-artifact@v4
with:
name: wasi-update_${{ matrix.target_alias }}
path: ${{ env.ARCHIVE_PATH }}
name: wasi-update-linux-x86_64
path: wasi-update_${{ github.ref_name }}_linux-x86_64.tar.bz2

- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-20.04' }}
with:
name: wasi-update_deb-amd64
name: wasi-update-linux-aarch64
path: wasi-update_${{ github.ref_name }}_linux-aarch64.tar.bz2

- uses: actions/upload-artifact@v4
with:
name: wasi-update-wasm32-wasi
path: wasi-update_${{ github.ref_name }}_wasm32-wasi.tar.bz2

- uses: actions/upload-artifact@v4
with:
name: wasi-update-deb-linux-x86_64
path: wasi-update_${{ github.ref_name }}_amd64.deb

release:
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-20.04

- builds-on-windows
- build-on-macos
- build-on-linux
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4

- name: Create release
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -103,9 +146,10 @@ jobs:
draft: true
prerelease: false
files: |
wasi-update_deb-amd64/*.deb
wasi-update_linux-x86_64/*.tar.bz2
wasi-update_linux-aarch64/*.tar.bz2
wasi-update_win-x86_64/*.zip
wasi-update_win-aarch64/*.zip
wasi-update_macos-aarch64/*.zip
wasi-update-deb-linux-x86_64/*.deb
wasi-update-linux-x86_64/*.tar.bz2
wasi-update-linux-aarch64/*.tar.bz2
wasi-update-wasm32-wasi/*.tar.bz2
wasi-update-macos-aarch64/*.tar.bz2
wasi-update-win-x86_64/*.zip
wasi-update-win-aarch64/*.zip
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
bin/wasi-update: src/src/precomp/wasi_snapshot_preview1.command.wasm src/src/precomp/wasi_snapshot_preview1.reactor.wasm src/Cargo.toml src/src/main.rs
cd src && cargo build --release $$CARGO_FLAGS
cd src && if which cargo-zigbuild ; then cargo-zigbuild build --release $$CARGO_FLAGS ; else cargo build --release $$CARGO_FLAGS ; fi
@ echo
@ install -d bin
-@ install -s src/target/release/wasi-update bin/ 2>/dev/null ||:
-@ install -s src/target/release/wasi-update.exe bin/ 2>/dev/null ||:
@ find src/target -type f \( -name 'wasi-update' -o -name 'wasi-update.exe' -o -name 'wasi-update.wasm' \) -print -exec install {} bin/ \;
-@ strip bin/wasi-update 2> /dev/null
ls -l bin/wasi-update*
@ echo
bin/wasi-update --help
- bin/wasi-update --help 2> /dev/null

src/src/precomp/wasi_snapshot_preview1.command.wasm: adapters/Cargo.toml adapters/src/descriptors.rs adapters/src/lib.rs adapters/src/macros.rs
cd adapters && cargo build --release --no-default-features --target=wasm32-unknown-unknown --features=command
Expand All @@ -16,12 +16,15 @@ src/src/precomp/wasi_snapshot_preview1.reactor.wasm: adapters/Cargo.toml adapter
cd adapters && cargo build --release --no-default-features --target=wasm32-unknown-unknown --features=reactor
install -m 0644 adapters/target/wasm32-unknown-unknown/release/wasi02_adapter.wasm src/src/precomp/wasi_snapshot_preview1.reactor.wasm

clean:
rm -fr adapters/byte-array-literals/target
rm -fr adapters/target
rm -fr src/src/ext/wit-component/target
clean-app:
rm -fr src/target
rm -f bin/wasi-update
touch */Cargo.toml


clean: clean-app
rm -fr adapters/byte-array-literals/target
rm -fr adapters/target
rm -fr src/src/ext/wit-component/target


0 comments on commit 98b8d24

Please sign in to comment.