build(deps): bump caches from 0.2.4 to 0.2.8 #187
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: "Push" | |
on: | |
release: | |
types: | |
- created | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
env: | |
VERSION: "${{ github.event_name == 'release' && github.event.release.name || github.sha }}" | |
jobs: | |
lint: | |
name: "Lint" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: cargo fmt | |
run: cargo fmt --all --check | |
- name: cargo clippy | |
run: cargo clippy --all-features -- --deny warnings | |
- name: cargo check | |
run: cargo check | |
test: | |
name: "Unit Tests" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run unit tests | |
run: cargo test --lib | |
build: | |
name: "Build" | |
strategy: | |
matrix: | |
include: | |
- os: "ubuntu-latest" | |
target: "x86_64-unknown-linux-gnu" | |
soname: "liblitevfs.so" | |
- os: "ubuntu-latest" | |
target: "x86_64-unknown-linux-musl" | |
soname: "liblitevfs.so" | |
- os: "ubuntu-latest" | |
target: "aarch64-unknown-linux-gnu" | |
soname: "liblitevfs.so" | |
- os: "ubuntu-latest" | |
target: "aarch64-unknown-linux-musl" | |
soname: "liblitevfs.so" | |
- os: "macos-latest" | |
target: "x86_64-apple-darwin" | |
soname: "liblitevfs.dylib" | |
- os: "macos-latest" | |
target: "aarch64-apple-darwin" | |
soname: "liblitevfs.dylib" | |
- os: "windows-latest" | |
target: "x86_64-pc-windows-msvc" | |
soname: "litevfs.dll" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: release | |
uses: bruceadams/[email protected] | |
if: github.event_name == 'release' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.target }} | |
- name: Install cross | |
if: matrix.os == 'ubuntu-latest' | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cross | |
- name: Build (cross) | |
if: matrix.os == 'ubuntu-latest' | |
run: cross build --package litevfs --release --target ${{ matrix.target }} | |
- name: Build | |
if: matrix.os != 'ubuntu-latest' | |
run: cargo build --package litevfs --release --target ${{ matrix.target }} | |
- name: Package | |
run: | | |
cd target/${{ matrix.target }}/release | |
tar -czvf litevfs-${{ env.VERSION }}-${{ matrix.target }}.tar.gz ${{ matrix.soname }} | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: litevfs-${{ env.VERSION }}-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/${{ matrix.soname }} | |
if-no-files-found: error | |
- name: Upload release | |
uses: actions/[email protected] | |
if: github.event_name == 'release' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: target/${{ matrix.target }}/release/litevfs-${{ env.VERSION }}-${{ matrix.target }}.tar.gz | |
asset_name: litevfs-${{ env.VERSION }}-${{ matrix.target }}.tar.gz | |
asset_content_type: application/gzip | |
build-wasm: | |
name: "Build WASM" | |
runs-on: "ubuntu-latest" | |
env: | |
EM_VERSION: 3.1.42 | |
EM_CACHE_FOLDER: 'emsdk-cache' | |
steps: | |
- uses: actions/checkout@v4 | |
- id: release | |
uses: bruceadams/[email protected] | |
if: github.event_name == 'release' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-unknown-emscripten | |
components: clippy, rustfmt | |
- uses: mymindstorm/setup-emsdk@v12 | |
with: | |
version: ${{ env.EM_VERSION }} | |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
- name: Install WABT | |
run: sudo apt-get install -y wabt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Setup cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.EM_CACHE_FOLDER }} | |
key: ${{ env.EM_VERSION }}-${{ runner.os }} | |
- name: Build | |
run: | | |
cargo xtask build-wasm | |
cd target | |
tar -czvf sqlite3-wasm-${{ env.VERSION }}.tar.gz sqlite3-wasm | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sqlite3-wasm-${{ env.VERSION }} | |
path: target/sqlite3-wasm | |
if-no-files-found: error | |
- name: Upload release | |
uses: actions/[email protected] | |
if: github.event_name == 'release' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: target/sqlite3-wasm-${{ env.VERSION }}.tar.gz | |
asset_name: sqlite3-wasm-${{ env.VERSION }}.tar.gz | |
asset_content_type: application/gzip | |
build-npm: | |
name: "Build NPM packages" | |
runs-on: "ubuntu-latest" | |
needs: "build" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
- uses: actions/download-artifact@v3 | |
with: | |
path: /tmp/litevfs | |
- name: "Build NPM packages" | |
run: | | |
cargo xtask build-npm-meta | |
cargo xtask build-npm-binary --lib /tmp/litevfs/litevfs-${{ env.VERSION }}-x86_64-unknown-linux-gnu/liblitevfs.so --cpu x64 --os linux --abi gnu | |
cargo xtask build-npm-binary --lib /tmp/litevfs/litevfs-${{ env.VERSION }}-x86_64-unknown-linux-musl/liblitevfs.so --cpu x64 --os linux --abi musl | |
cargo xtask build-npm-binary --lib /tmp/litevfs/litevfs-${{ env.VERSION }}-aarch64-unknown-linux-gnu/liblitevfs.so --cpu arm64 --os linux --abi gnu | |
cargo xtask build-npm-binary --lib /tmp/litevfs/litevfs-${{ env.VERSION }}-aarch64-unknown-linux-musl/liblitevfs.so --cpu arm64 --os linux --abi musl | |
cargo xtask build-npm-binary --lib /tmp/litevfs/litevfs-${{ env.VERSION }}-x86_64-apple-darwin/liblitevfs.dylib --cpu x64 --os darwin | |
cargo xtask build-npm-binary --lib /tmp/litevfs/litevfs-${{ env.VERSION }}-aarch64-apple-darwin/liblitevfs.dylib --cpu arm64 --os darwin | |
cargo xtask build-npm-binary --lib /tmp/litevfs/litevfs-${{ env.VERSION }}-x86_64-pc-windows-msvc/litevfs.dll --cpu x64 --os windows | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: npm-packages-${{ env.VERSION }} | |
path: target/npm | |
if-no-files-found: error | |
- name: Publish NPM packages | |
if: github.event_name == 'release' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
cd target/npm | |
for p in litevfs-*.tgz; do | |
npm publish $p | |
done |