Update Rust crate serde to v1.0.214 #182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Binary | |
on: | |
push: | |
jobs: | |
test: | |
name: Test | |
runs-on: macos-latest | |
permissions: | |
actions: write | |
outputs: | |
changed: ${{ steps.rust-changed.outputs.cache-hit }} | |
steps: | |
- uses: actions/checkout@v4 | |
# This is a hack, it's just used to exit early if nothing has changed | |
- name: Check for changes to Rust files | |
uses: actions/cache@v4 | |
id: rust-changed | |
with: | |
lookup-only: true | |
path: | | |
.gitignore | |
key: ${{ runner.os }}-rust-test-${{ hashFiles('.github/workflows/rust-binary.yml', 'Cargo.lock', 'Cargo.toml', 'rust-toolchain.toml', '**/*.rs') }} | |
- name: Install Rust | |
if: steps.rust-changed.outputs.cache-hit != 'true' | |
uses: oxidecomputer/actions-rs_toolchain@oxide/master | |
- name: Run cargo test | |
if: steps.rust-changed.outputs.cache-hit != 'true' | |
run: cargo test | |
- name: Check for changed files | |
if: steps.rust-changed.outputs.cache-hit != 'true' | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
echo "Files have changed after running tests:" | |
git status --porcelain | |
exit 1 | |
fi | |
build: | |
needs: test | |
if: needs.test.outputs.changed != 'true' | |
name: Build on ${{ matrix.os }} for ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: ${{ github.ref == 'refs/heads/main' }} | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
binary_name: deno-webview-linux | |
- os: ubuntu-latest | |
target: x86_64-pc-windows-msvc | |
binary_name: deno-webview-windows | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
binary_name: deno-webview-mac | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
binary_name: deno-webview-mac-arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: oxidecomputer/actions-rs_toolchain@oxide/master | |
with: | |
target: ${{ matrix.target }} | |
- name: Install libwebkit2gtk (Linux) | |
if: matrix.target == 'x86_64-unknown-linux-gnu' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev | |
- name: Get cargo-xwin version | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
id: cargo-xwin-version | |
run: | | |
VERSION=$(cargo search cargo-xwin --limit 1 | awk -F '"' '{print $2}') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Cache cargo-xwin | |
uses: actions/cache@v4 | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
id: cache-cargo-xwin | |
with: | |
path: ~/.cargo/bin/cargo-xwin | |
key: ${{ runner.os }}-cargo-xwin-${{ steps.cargo-xwin-version.outputs.version }}-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Install cargo-xwin (for Windows build) | |
if: matrix.target == 'x86_64-pc-windows-msvc' && steps.cache-cargo-xwin.outputs.cache-hit != 'true' | |
run: cargo install cargo-xwin | |
- name: Set build flags | |
id: build_flags | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
echo "flags=--release" >> $GITHUB_OUTPUT | |
echo "build_type=release" >> $GITHUB_OUTPUT | |
else | |
echo "flags=" >> $GITHUB_OUTPUT | |
echo "build_type=debug" >> $GITHUB_OUTPUT | |
fi | |
- name: Build Linux | |
if: matrix.target == 'x86_64-unknown-linux-gnu' | |
run: | | |
cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }} | |
cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent -F devtools | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }}-devtools | |
- name: Build macOS x86_64 | |
if: matrix.target == 'x86_64-apple-darwin' | |
run: | | |
cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }} | |
cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }}-transparent | |
cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent -F devtools | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }}-devtools | |
- name: Build (aarch64-apple-darwin) | |
if: matrix.target == 'aarch64-apple-darwin' | |
run: | | |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }} | |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }}-transparent | |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) cargo build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent -F devtools | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview ${{ matrix.binary_name }}-devtools | |
- name: Build (Windows) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
run: | | |
cargo xwin build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview.exe ${{ matrix.binary_name }}.exe | |
cargo xwin build ${{ steps.build_flags.outputs.flags }} --target ${{ matrix.target }} -F transparent -F devtools | |
mv target/${{ matrix.target }}/${{ steps.build_flags.outputs.build_type }}/deno-webview.exe ${{ matrix.binary_name }}-devtools.exe | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build_flags.outputs.build_type }}-binary-${{ matrix.target }} | |
path: ${{ matrix.binary_name }}* |