Dont require Cargo.lock #103
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: Build and Test | |
on: | |
push: | |
branches: | |
- 'dev' | |
- 'main' | |
pull_request: | |
jobs: | |
semver-checks: | |
runs-on: ubuntu-latest | |
name: cargo semver-checks | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: obi1kenobi/cargo-semver-checks-action@v2 | |
check-versions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
- name: Check versions | |
run: | | |
# Get package.json version | |
PKG_VERSION=$(node -p "require('./package.json').version") | |
# Get Cargo.toml version | |
CARGO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version') | |
echo "package.json version: $PKG_VERSION" | |
echo "Cargo.toml version: $CARGO_VERSION" | |
if [ "$PKG_VERSION" != "$CARGO_VERSION" ]; then | |
echo "Version mismatch:" | |
echo "package.json: $PKG_VERSION" | |
echo "Cargo.toml: $CARGO_VERSION" | |
exit 1 | |
fi | |
echo "Versions match: $PKG_VERSION" | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
features: | |
- "" | |
- "elgamal3" | |
- "legacy-pep-repo-compatible" | |
- "elgamal3,legacy-pep-repo-compatible" | |
name: cargo test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- run: cargo test --features "${{ matrix.features }}" | |
build-wasm: | |
runs-on: ubuntu-latest | |
needs: test | |
strategy: | |
matrix: | |
target: [ "web", "nodejs" ] | |
features: [ "", "elgamal3" ] | |
name: wasm-pack build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- run: cargo install wasm-pack | |
- run: npm install | |
- run: npm test | |
- run: wasm-pack build --target ${{ matrix.target }} --features "wasm,${{ matrix.features }}" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: libpep-wasm-${{ matrix.target }}-${{ matrix.features }} | |
path: pkg/ |