From b169e941b5bd1adbf734ed92e4d83f005b4d39ce Mon Sep 17 00:00:00 2001 From: Vincent Emonet Date: Sat, 30 Mar 2024 14:00:06 +0100 Subject: [PATCH] try fixing issue with npm test publish happening in gh action only --- .github/workflows/build.yml | 4 ++-- .github/workflows/test.yml | 14 ++++---------- js/tests/nanopub.test.ts | 2 +- lib/src/nanopub.rs | 5 +++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e5b1cc..4e713cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: # '--target', 'x86_64-linux-android', build_binaries: - name: Build binaries for ${{ matrix.target }} + name: 📦️ Build binaries for ${{ matrix.target }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -239,7 +239,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') publish_crates: - name: 📦️ Publish crates to crates.io + name: 🦀 Publish nanopub crate to crates.io if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4b83e4..951a160 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,8 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: rustup update - - run: rustup component add clippy rustfmt + - run: rustup update && rustup component add clippy rustfmt - run: cargo fmt -- --check - run: cargo clippy --all --all-targets --all-features @@ -24,9 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: | - rustup update - cargo install cargo-tarpaulin + - run: rustup update && cargo install cargo-tarpaulin - run: cargo build --all-features - run: cargo test env: @@ -44,9 +41,7 @@ jobs: registry-url: 'https://registry.npmjs.org' cache: npm cache-dependency-path: "./js/package.json" - - run: | - rustup update - cargo install wasm-pack + - run: rustup update && cargo install wasm-pack - name: Run tests run: ./scripts/test-js.sh @@ -72,8 +67,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Generate code coverage - run: | - cargo tarpaulin -p nanopub --out xml --exclude-files lib/src/error.rs --verbose --timeout 120 + run: cargo tarpaulin -p nanopub --out xml --exclude-files lib/src/error.rs --verbose --timeout 120 - name: Upload to codecov.io uses: codecov/codecov-action@v4 diff --git a/js/tests/nanopub.test.ts b/js/tests/nanopub.test.ts index 7c27e71..75f0e22 100644 --- a/js/tests/nanopub.test.ts +++ b/js/tests/nanopub.test.ts @@ -33,7 +33,7 @@ const unsignedRdf = `@prefix : . a npx:ExampleNanopub . }` -describe('Tests for the curies npm package', () => { +describe('Tests for the @nanopub/sign npm package', () => { // NOTE: `await init()` only needed in browser environment test('publish nanopub', async () => { diff --git a/lib/src/nanopub.rs b/lib/src/nanopub.rs index e1b2210..be0ee09 100644 --- a/lib/src/nanopub.rs +++ b/lib/src/nanopub.rs @@ -13,7 +13,7 @@ use rsa::pkcs8::DecodePublicKey; use rsa::{sha2::Digest, sha2::Sha256, Pkcs1v15Sign, RsaPublicKey}; use sophia::api::dataset::{Dataset, MutableDataset}; use sophia::api::ns::{rdf, xsd, Namespace}; -use sophia::api::term::{matcher::Any, Term}; +use sophia::api::term::{matcher::Any, SimpleTerm, Term}; use sophia::inmem::dataset::LightDataset; use sophia::iri::{AsIriRef, Iri}; use std::collections::HashSet; @@ -250,7 +250,8 @@ impl Nanopub { self.dataset.insert( self.info.ns.as_iri_ref(), ns("dct").get("created")?, - datetime_str.as_str() * xsd::dateTime, + SimpleTerm::LiteralDatatype(datetime_str.into(), xsd::dateTime.iriref()), + // TODO: datetime_str.as_str() * xsd::dateTime, Some(&self.info.pubinfo), )?; }