Skip to content

Commit

Permalink
Expand CI coverage (#112)
Browse files Browse the repository at this point in the history
* run tests on mac and linux

* Update action versions

* Run on windows
  • Loading branch information
benbrandt authored Oct 24, 2024
1 parent 72348e0 commit 257ae87
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 83 deletions.
106 changes: 45 additions & 61 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}"
Expand All @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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')
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
54 changes: 32 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 257ae87

Please sign in to comment.