diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3b5d6ee..f1a4b6d 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: @@ -192,26 +178,26 @@ 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 - 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 937fd6b..f46eda0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,50 +16,60 @@ 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" } + - { os: "windows-latest", wasiSDK: "mingw" } + runs-on: ${{ matrix.config.os }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - submodules: 'recursive' + 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 + - 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}-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 + + - 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 - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: cpython/builddir/wasi key: cpython-wasi