From 000232030cc632df85c2499c59cdf1af3528c94d Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Wed, 23 Oct 2024 20:41:06 +0200 Subject: [PATCH 1/3] run tests on mac and linux --- .github/workflows/test.yaml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 937fd6b..2193cc5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,12 +16,18 @@ env: jobs: test: name: Test - runs-on: "ubuntu-latest" + strategy: + fail-fast: false + matrix: + config: + - { os: "ubuntu-latest", wasiSDK: "linux" } + - { os: "macos-latest", wasiSDK: "macos" } + runs-on: ${{ matrix.config.os }} steps: - name: Checkout uses: actions/checkout@v3 with: - submodules: 'recursive' + submodules: "recursive" - name: Install latest Rust stable toolchain uses: actions-rs/toolchain@v1 @@ -53,9 +59,9 @@ jobs: shell: bash run: | cd /tmp - curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz - tar xf wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz - mv wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk + curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz + tar xf wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz + sudo mv wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk - name: Cache CPython id: cache-cpython-wasi From 7860645485ceeb511ea511c63815fb2a042f9e0e Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Thu, 24 Oct 2024 12:35:29 +0200 Subject: [PATCH 2/3] Update action versions --- .github/workflows/release.yaml | 92 ++++++++++++++-------------------- .github/workflows/test.yaml | 26 ++++------ 2 files changed, 48 insertions(+), 70 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3b5d6ee..c0aaaa0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,35 +25,29 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - submodules: 'recursive' + submodules: "recursive" - uses: actions/setup-python@v4 with: - python-version: '3.12' + python-version: "3.12" - - name: Install latest Rust stable toolchain - uses: actions-rs/toolchain@v1 + - name: Install latest Rust nightly toolchain + uses: dtolnay/rust-toolchain@nightly with: - toolchain: stable - default: true - components: clippy, rustfmt + targets: wasm32-wasi wasm32-unknown-unknown - - name: Install latest Rust nightly toolchain - uses: actions-rs/toolchain@v1 + - name: Install latest Rust stable toolchain + uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly - default: false + targets: wasm32-wasi wasm32-unknown-unknown + components: clippy, rustfmt - name: Install Rust std source shell: bash run: rustup component add rust-src --toolchain nightly - - name: Install Wasm Rust targets - shell: bash - run: rustup target add wasm32-wasi wasm32-unknown-unknown - - uses: Swatinem/rust-cache@v2 with: shared-key: "rust-cache-${{ hashFiles('./Cargo.lock') }}" @@ -69,7 +63,7 @@ jobs: - name: Cache CPython id: cache-cpython-wasi - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: cpython/builddir/wasi key: cpython-wasi @@ -106,7 +100,7 @@ jobs: buildArgs: "--target aarch64-unknown-linux-gnu", target: "aarch64-unknown-linux-gnu", targetDir: "target/aarch64-unknown-linux-gnu/release", - } + } - { os: "macos-latest", arch: "amd64", @@ -139,36 +133,28 @@ jobs: } steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - submodules: 'recursive' + submodules: "recursive" - uses: actions/setup-python@v4 with: - python-version: '3.12' + python-version: "3.12" - - name: Install latest Rust stable toolchain - uses: actions-rs/toolchain@v1 + - name: Install latest Rust nightly toolchain + uses: dtolnay/rust-toolchain@nightly with: - toolchain: stable - default: true - target: ${{ matrix.config.target }} + targets: ${{ matrix.config.target }} - - name: Install latest Rust nightly toolchain - uses: actions-rs/toolchain@v1 + - name: Install latest Rust stable toolchain + uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly - default: false - target: ${{ matrix.config.target }} + targets: ${{ matrix.config.target }} - name: Install Rust std source shell: bash run: rustup component add rust-src --toolchain nightly - - name: Install Wasm Rust targets - shell: bash - run: rustup target add wasm32-wasi wasm32-unknown-unknown - - uses: Swatinem/rust-cache@v2 if: matrix.config.os == 'ubuntu-latest' && matrix.config.arch == 'amd64' with: @@ -211,7 +197,7 @@ jobs: - name: Restore CPython id: cache-cpython-wasi - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: cpython/builddir/wasi key: cpython-wasi @@ -252,16 +238,16 @@ jobs: componentize-py${{ matrix.config.extension }} - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: componentize-py path: dist - name: Upload build artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: componentize-py - path: _dist/componentize-py-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz + name: componentize-py + path: _dist/componentize-py-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz - name: Upload binary to Github release (tag) if: startsWith(github.ref, 'refs/tags/v') @@ -287,15 +273,15 @@ jobs: run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV - name: Download release assets - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: componentize-py + name: componentize-py - name: Generate checksums run: | sha256sum componentize-py-${{ env.RELEASE_VERSION }}*.tar.gz > checksums-${{ env.RELEASE_VERSION }}.txt - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: componentize-py path: checksums-${{ env.RELEASE_VERSION }}.txt @@ -313,17 +299,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - submodules: 'recursive' - + submodules: "recursive" + - name: Build sdist uses: PyO3/maturin-action@v1 with: command: sdist args: --out dist - name: Upload sdist - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: componentize-py path: dist @@ -335,19 +321,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Download release assets - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: componentize-py + name: componentize-py - name: Delete canary tag - uses: dev-drprasad/delete-tag-and-release@v0.2.1 + run: gh release delete --cleanup-tag -y env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: canary + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Recreate canary tag and release - uses: ncipollo/release-action@v1.10.0 + uses: ncipollo/release-action@v1 with: tag: canary allowUpdates: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2193cc5..f4e83d2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,35 +25,29 @@ jobs: runs-on: ${{ matrix.config.os }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: "recursive" - - name: Install latest Rust stable toolchain - uses: actions-rs/toolchain@v1 + - name: Install latest Rust nightly toolchain + uses: dtolnay/rust-toolchain@nightly with: - toolchain: stable - default: true - components: clippy, rustfmt + targets: wasm32-wasi wasm32-unknown-unknown - - name: Install latest Rust nightly toolchain - uses: actions-rs/toolchain@v1 + - name: Install latest Rust stable toolchain + uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly - default: false + targets: wasm32-wasi wasm32-unknown-unknown + components: clippy, rustfmt - name: Install Rust std source shell: bash run: rustup component add rust-src --toolchain nightly - - name: Install Wasm Rust targets - shell: bash - run: rustup target add wasm32-wasi wasm32-unknown-unknown - - uses: Swatinem/rust-cache@v2 with: shared-key: "rust-cache-${{ hashFiles('./Cargo.lock') }}" - cache-on-failure: "false" + cache-on-failure: false - name: Install WASI-SDK shell: bash @@ -65,7 +59,7 @@ jobs: - name: Cache CPython id: cache-cpython-wasi - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: cpython/builddir/wasi key: cpython-wasi From 5aa61d1c9ef6aa2c0c9a08776ee1af0ac44864ce Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Thu, 24 Oct 2024 13:52:30 +0200 Subject: [PATCH 3/3] Run on windows --- .github/workflows/release.yaml | 14 +++++++------- .github/workflows/test.yaml | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c0aaaa0..f1a4b6d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -178,22 +178,22 @@ jobs: OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') echo "RUNNER_OS=$OS" >> $GITHUB_ENV - - name: Install WASI-SDK - if: runner.os != 'Windows' + - name: Download WASI-SDK shell: bash run: | cd /tmp curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz tar xf wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz - sudo mv wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk + + - name: Install WASI-SDK + if: runner.os != 'Windows' + shell: bash + run: sudo mv /tmp/wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk - name: Install WASI-SDK on Windows if: runner.os == 'Windows' shell: bash - run: | - curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-mingw.tar.gz - tar xf wasi-sdk-${WASI_SDK_VERSION}-mingw.tar.gz - echo "WASI_SDK_PATH=$(cygpath -m $(pwd)/wasi-sdk-${WASI_SDK_VERSION})" >> ${GITHUB_ENV} + run: echo "WASI_SDK_PATH=$(cygpath -m /tmp/wasi-sdk-${WASI_SDK_VERSION})" >> ${GITHUB_ENV} - name: Restore CPython id: cache-cpython-wasi diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f4e83d2..f46eda0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,6 +22,7 @@ jobs: config: - { os: "ubuntu-latest", wasiSDK: "linux" } - { os: "macos-latest", wasiSDK: "macos" } + - { os: "windows-latest", wasiSDK: "mingw" } runs-on: ${{ matrix.config.os }} steps: - name: Checkout @@ -49,13 +50,22 @@ jobs: shared-key: "rust-cache-${{ hashFiles('./Cargo.lock') }}" cache-on-failure: false - - name: Install WASI-SDK + - name: Download WASI-SDK shell: bash run: | cd /tmp curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz tar xf wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz - sudo mv wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk + + - name: Install WASI-SDK + if: runner.os != 'Windows' + shell: bash + run: sudo mv /tmp/wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk + + - name: Install WASI-SDK on Windows + if: runner.os == 'Windows' + shell: bash + run: echo "WASI_SDK_PATH=$(cygpath -m /tmp/wasi-sdk-${WASI_SDK_VERSION})" >> ${GITHUB_ENV} - name: Cache CPython id: cache-cpython-wasi