Skip to content

Add npm publishing script and guide #13

Add npm publishing script and guide

Add npm publishing script and guide #13

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
continue-on-error: true
- name: Check formatting
run: cargo fmt -- --check
continue-on-error: true
build-release:
name: Build Release Binary - ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_name: wake
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build Release
run: cargo build --release --target ${{ matrix.target }}
continue-on-error: true
- name: Check if binary exists
run: |
if [ -f "target/${{ matrix.target }}/release/${{ matrix.binary_name }}" ]; then
echo "Binary built successfully"
ls -la target/${{ matrix.target }}/release/${{ matrix.binary_name }}
else
echo "Binary build failed, but continuing"
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: success()
with:
name: wake-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.binary_name }}