diff --git a/.github/workflows/Benchmarks.yml b/.github/workflows/Benchmarks.yml index f47b97f..29b3759 100644 --- a/.github/workflows/Benchmarks.yml +++ b/.github/workflows/Benchmarks.yml @@ -60,7 +60,7 @@ jobs: - name: Download benchmark from most recent release run: | - just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} + just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} ${{ matrix.cpu }} continue-on-error: true working-directory: ./src/hyperlight_wasm env: @@ -74,6 +74,6 @@ jobs: - name: Upload Benchmarks uses: actions/upload-artifact@v4 with: - name: benchmarks_${{runner.os}}_${{matrix.hypervisor}} + name: benchmarks_${{runner.os}}_${{matrix.hypervisor}}_${{ matrix.cpu }} path: ./target/criterion/ if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/CreateRelease.yml b/.github/workflows/CreateRelease.yml index fba3567..a12af24 100644 --- a/.github/workflows/CreateRelease.yml +++ b/.github/workflows/CreateRelease.yml @@ -73,59 +73,33 @@ jobs: - name: Build rust wasm modules run: just build-rust-wasm-examples ${{ env.CONFIG }} shell: bash - - name: Download Benchmarks (Windows) + - name: Download all benchmarks uses: actions/download-artifact@v4 with: - name: benchmarks_Windows_whp - path: benchmarks_Windows_whp - - name: Download Benchmarks (Linux hyperv) - uses: actions/download-artifact@v4 - with: - name: benchmarks_Linux_hyperv - path: benchmarks_Linux_hyperv - - name: Download Benchmarks (Linux kvm) - uses: actions/download-artifact@v4 - with: - name: benchmarks_Linux_kvm - path: benchmarks_Linux_kvm + pattern: benchmarks_* - name: Archive benchmarks run: | - tar -zcvf benchmarks_Windows_whp.tar.gz benchmarks_Windows_whp - tar -zcvf benchmarks_Linux_hyperv.tar.gz benchmarks_Linux_hyperv - tar -zcvf benchmarks_Linux_kvm.tar.gz benchmarks_Linux_kvm - - name: Install github-cli - run: | - $ProgressPreference = 'SilentlyContinue' - # check if gh cli is installed - $installed = [bool](Get-Command -ErrorAction Ignore -Type Application gh) - if ($installed) { Write-Host "gh cli already installed"; exit 0 } - # download and install gh cli - Invoke-WebRequest https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_windows_amd64.msi -OutFile gh.msi - msiexec.exe /i gh.msi /quiet /l log.txt | Out-Null - Write-Host "msiexec exited with code $LASTEXITCCODE" - if ($LASTEXITCODE -ne 0) { cat log.txt; exit 1 } + for BENCHMARK in benchmarks_*; do + tar -zcvf $BENCHMARK.tar.gz $BENCHMARK + done - name: Create pre-release if: ${{ github.ref=='refs/heads/main' }} run: | - echo "PWD: $PWD" - ls -alR - gh release delete dev-latest -y --cleanup-tag || true - gh release create dev-latest -t "Latest Development Build From Dev Branch" --latest=false -p \ - benchmarks_Windows_whp.tar.gz \ - benchmarks_Linux_hyperv.tar.gz \ - benchmarks_Linux_kvm.tar.gz + echo "PWD: $PWD" + ls -alR + gh release delete dev-latest -y --cleanup-tag || true + gh release create dev-latest -t "Latest Development Build From Dev Branch" --latest=false -p \ + benchmarks_*.tar.gz env: GH_TOKEN: ${{ github.token }} shell: bash - name: Create Release if: ${{ contains(github.ref, 'refs/heads/release/') }} run: | - echo "PWD: $PWD" - ls -alR - gh release create v${{ env.HYPERLIGHTWASM_VERSION }} -t "Release v${{ env.HYPERLIGHTWASM_VERSION }}" --generate-notes \ - benchmarks_Windows_whp.tar.gz \ - benchmarks_Linux_hyperv.tar.gz \ - benchmarks_Linux_kvm.tar.gz + echo "PWD: $PWD" + ls -alR + gh release create v${{ env.HYPERLIGHTWASM_VERSION }} -t "Release v${{ env.HYPERLIGHTWASM_VERSION }}" --generate-notes \ + benchmarks_*.tar.gz env: GH_TOKEN: ${{ github.token }} shell: bash diff --git a/.github/workflows/dep_build_wasm_examples.yml b/.github/workflows/dep_build_wasm_examples.yml index 25a44bb..0bc874a 100644 --- a/.github/workflows/dep_build_wasm_examples.yml +++ b/.github/workflows/dep_build_wasm_examples.yml @@ -51,6 +51,17 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/wasm-clang-builder + - name: Calculate ghcr cache destination + env: + CAN_WRITE: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) && github.actor != 'dependabot[bot]' }} + run: | + if [ "$CAN_WRITE" = "true" ]; then + echo "CACHE_TO=type=registry,ref=ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:buildcache,mode=max" >> $GITHUB_ENV + echo "DO_PUSH=true" >> $GITHUB_ENV + else + echo "CACHE_TO=type=local,dest=/tmp/wasm-clang-builder-cache/" >> $GITHUB_ENV + echo "DO_PUSH=false" >> $GITHUB_ENV + fi - name: Build and push wasm-clang-builder # Only push if not from a fork, not from pull request, and not from dependabot uses: docker/build-push-action@v6 @@ -58,13 +69,13 @@ jobs: context: src/wasmsamples file: src/wasmsamples/dockerfile load: true - push: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) && github.actor != 'dependabot[bot]' }} + push: ${{ env.DO_PUSH }} build-args: | WASI_SDK_VERSION_FULL=20.0 GCC_VERSION=12 tags: ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:latest cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:buildcache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:buildcache,mode=max + cache-to: ${{ env.CACHE_TO }} - name: Build Modules run: | for FILENAME in $(find . -name '*.c') diff --git a/.github/workflows/dep_rust.yml b/.github/workflows/dep_rust.yml index b7eca06..2bca5c9 100644 --- a/.github/workflows/dep_rust.yml +++ b/.github/workflows/dep_rust.yml @@ -131,7 +131,7 @@ jobs: - name: Download benchmarks from "latest" run: | - just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} dev-latest + just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} ${{ matrix.cpu }} dev-latest env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} continue-on-error: true diff --git a/Justfile b/Justfile index 54259a9..5286903 100644 --- a/Justfile +++ b/Justfile @@ -104,7 +104,7 @@ bench-ci baseline target=default-target features="": cd src/hyperlight_wasm && cargo bench --profile={{ if target == "debug" {"dev"} else { target } }} {{ if features =="" {''} else { "--features " + features } }} -- --verbose --save-baseline {{baseline}} bench target=default-target features="": cd src/hyperlight_wasm && cargo bench --profile={{ if target == "debug" {"dev"} else { target } }} {{ if features =="" {''} else { "--features " + features } }} -- --verbose -bench-download os hypervisor tag="": - gh release download {{ tag }} -D ./src/hyperlight_wasm/target/ -p benchmarks_{{ os }}_{{ hypervisor }}.tar.gz +bench-download os hypervisor cpu tag="": + gh release download {{ tag }} -D ./src/hyperlight_wasm/target/ -p benchmarks_{{ os }}_{{ hypervisor }}_{{ cpu }}.tar.gz mkdir {{ mkdir-arg }} ./src/hyperlight_wasm/target/criterion - tar -zxvf ./src/hyperlight_wasm/target/benchmarks_{{ os }}_{{ hypervisor }}.tar.gz -C ./src/hyperlight_wasm/target/criterion/ --strip-components=1 + tar -zxvf ./src/hyperlight_wasm/target/benchmarks_{{ os }}_{{ hypervisor }}_{{ cpu }}.tar.gz -C ./src/hyperlight_wasm/target/criterion/ --strip-components=1