From 77f85a101aaface856bd8ad4bf277e79f034d7f2 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 13:50:24 +0100 Subject: [PATCH 1/9] Fix #513 --- thoth-api/migrations/v0.12.6/down.sql | 11 +++++++++++ thoth-api/migrations/v0.12.6/up.sql | 11 +++++++++++ thoth-api/src/model/mod.rs | 8 ++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 thoth-api/migrations/v0.12.6/down.sql create mode 100644 thoth-api/migrations/v0.12.6/up.sql diff --git a/thoth-api/migrations/v0.12.6/down.sql b/thoth-api/migrations/v0.12.6/down.sql new file mode 100644 index 000000000..40680f441 --- /dev/null +++ b/thoth-api/migrations/v0.12.6/down.sql @@ -0,0 +1,11 @@ +ALTER TABLE work DROP CONSTRAINT work_doi_check; +ALTER TABLE work ADD CONSTRAINT work_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$'); + +ALTER TABLE reference DROP CONSTRAINT reference_doi_check; +ALTER TABLE reference ADD CONSTRAINT reference_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$'); + +ALTER TABLE institution DROP CONSTRAINT institution_institution_doi_check; +ALTER TABLE institution ADD CONSTRAINT institution_institution_doi_check + CHECK (institution_doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$'); diff --git a/thoth-api/migrations/v0.12.6/up.sql b/thoth-api/migrations/v0.12.6/up.sql new file mode 100644 index 000000000..c3f17d5b9 --- /dev/null +++ b/thoth-api/migrations/v0.12.6/up.sql @@ -0,0 +1,11 @@ +ALTER TABLE work DROP CONSTRAINT work_doi_check; +ALTER TABLE work ADD CONSTRAINT work_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._;()\/:a-zA-Z0-9<>+[\]]+$'); + +ALTER TABLE reference DROP CONSTRAINT reference_doi_check; +ALTER TABLE reference ADD CONSTRAINT reference_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._;()\/:a-zA-Z0-9<>+[\]]+$'); + +ALTER TABLE institution DROP CONSTRAINT institution_institution_doi_check; +ALTER TABLE institution ADD CONSTRAINT institution_institution_doi_check + CHECK (institution_doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._;()\/:a-zA-Z0-9<>+[\]]+$'); diff --git a/thoth-api/src/model/mod.rs b/thoth-api/src/model/mod.rs index c0a6aa7ad..0e09fd9c3 100644 --- a/thoth-api/src/model/mod.rs +++ b/thoth-api/src/model/mod.rs @@ -46,7 +46,7 @@ pub enum WeightUnit { feature = "backend", derive(DieselNewType, juniper::GraphQLScalarValue), graphql( - description = r#"Digital Object Identifier. Expressed as `^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$`"# + description = r#"Digital Object Identifier. Expressed as `^https:\/\/doi\.org\/10\.\d{4,9}\/[-._;()\/:a-zA-Z0-9<>+\[\]]+$`"# ) )] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)] @@ -144,7 +144,7 @@ impl FromStr for Doi { // and captures the identifier segment starting with the "10." directory indicator // Corresponds to database constraints although regex syntax differs slightly // (e.g. `;()/` do not need to be escaped here) - r"^(?i:(?:https?://)?(?:www\.)?(?:dx\.)?doi\.org/)?(10\.\d{4,9}/[-._;()\[\]<>/:a-zA-Z0-9]+$)").unwrap(); + r"^(?i:(?:https?://)?(?:www\.)?(?:dx\.)?doi\.org/)?(10\.\d{4,9}/[-._;()\/:a-zA-Z0-9<>+\[\]]+$)").unwrap(); } if input.is_empty() { Err(ThothError::DoiEmptyError) @@ -707,6 +707,10 @@ fn test_doi_fromstr() { "https://doi.org/10.1002/(SICI)1098-2736(199908)36:6<637::AID-TEA4>3.0.CO;2-9" ) .is_ok()); + assert!(Doi::from_str( + "https://doi.org/10.1002/(sici)1096-8644(1996)23+<91::aid-ajpa4>3.0.co;2-c" + ) + .is_ok()); } #[test] From be73f98c7d6eab7abe6c52ef401baa2641599786 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 13:50:30 +0100 Subject: [PATCH 2/9] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 756e7d74e..8d8cfb96f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- [#513](https://github.com/thoth-pub/thoth/issues/513) - Expand DOI regex to include `+`, `[]`, and `]` ## [[0.12.5]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.5) - 2024-05-07 ### Changed From dc320b5944b9ab9e2e7424d83d630c000730d2c1 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 13:53:44 +0100 Subject: [PATCH 3/9] Upgrade rust 1.79.0 --- Dockerfile | 2 +- Dockerfile.dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 911d1e904..7392d60a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG MUSL_IMAGE=clux/muslrust:1.78.0-stable +ARG MUSL_IMAGE=clux/muslrust:1.79.0-stable FROM ${MUSL_IMAGE} as build diff --git a/Dockerfile.dev b/Dockerfile.dev index 5fbfd2598..0eb9aa8d2 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -ARG RUST_VERSION=1.78.0 +ARG RUST_VERSION=1.79.0 FROM rust:${RUST_VERSION} From 33ca82163cdd9b0a71a6c5c80626879fdcf79a24 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 13:54:33 +0100 Subject: [PATCH 4/9] Update changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d8cfb96f..da57e4950 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed -- [#513](https://github.com/thoth-pub/thoth/issues/513) - Expand DOI regex to include `+`, `[]`, and `]` + - [#513](https://github.com/thoth-pub/thoth/issues/513) - Expand DOI regex to include `+`, `[]`, and `]` + +### Changed + - [607](https://github.com/thoth-pub/thoth/pull/607) - Upgrade rust to `1.79.0` in production and development `Dockerfile` ## [[0.12.5]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.5) - 2024-05-07 ### Changed From 26279c328a926733853431f5659b441b5a496725 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 13:56:04 +0100 Subject: [PATCH 5/9] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da57e4950..1f2188d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed - - [#513](https://github.com/thoth-pub/thoth/issues/513) - Expand DOI regex to include `+`, `[]`, and `]` + - [#513](https://github.com/thoth-pub/thoth/issues/513) - Expand DOI regex to include `+`, `[`, and `]` ### Changed - [607](https://github.com/thoth-pub/thoth/pull/607) - Upgrade rust to `1.79.0` in production and development `Dockerfile` From 626b7d0e2932d25d2b39295464020988ac1bc957 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 14:38:15 +0100 Subject: [PATCH 6/9] Add caching to github actions --- .github/workflows/build_test_and_check.yml | 27 ++++++++++++++++++++++ .github/workflows/run_migrations.yml | 9 ++++++++ 2 files changed, 36 insertions(+) diff --git a/.github/workflows/build_test_and_check.yml b/.github/workflows/build_test_and_check.yml index 385d4dd47..91c8aff1f 100644 --- a/.github/workflows/build_test_and_check.yml +++ b/.github/workflows/build_test_and_check.yml @@ -33,18 +33,45 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build binary run: cargo build -vv test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Run tests run: cargo test --workspace -vv lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Run linting run: cargo clippy --all --all-targets --all-features -- -D warnings format_check: diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml index 07dceb3b0..a709689a1 100644 --- a/.github/workflows/run_migrations.yml +++ b/.github/workflows/run_migrations.yml @@ -41,6 +41,15 @@ jobs: - 5432:5432 steps: - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build binary run: cargo build -vv - name: Run migrations From 55909287e7adc0ad17601c006f7ec36048bdb870 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 14:38:53 +0100 Subject: [PATCH 7/9] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f2188d33..0c745bde0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - [607](https://github.com/thoth-pub/thoth/pull/607) - Upgrade rust to `1.79.0` in production and development `Dockerfile` +### Added + - [607](https://github.com/thoth-pub/thoth/pull/607) - Add caching steps to Github actions + ## [[0.12.5]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.5) - 2024-05-07 ### Changed - [601](https://github.com/thoth-pub/thoth/pull/601) - Upgrade rust to `1.78.0` in production and development `Dockerfile` From 887f873fdcadd8ec3029b1b647a03cdf6ed96155 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 15:24:28 +0100 Subject: [PATCH 8/9] Bump v0.12.6 --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 12 ++++++------ thoth-api-server/Cargo.toml | 6 +++--- thoth-api/Cargo.toml | 4 ++-- thoth-app-server/Cargo.toml | 2 +- thoth-app/Cargo.toml | 6 +++--- thoth-client/Cargo.toml | 8 ++++---- thoth-errors/Cargo.toml | 2 +- thoth-export-server/Cargo.toml | 8 ++++---- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b037780bd..2297d98fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3087,7 +3087,7 @@ dependencies = [ [[package]] name = "thoth" -version = "0.12.5" +version = "0.12.6" dependencies = [ "cargo-husky", "clap", @@ -3102,7 +3102,7 @@ dependencies = [ [[package]] name = "thoth-api" -version = "0.12.5" +version = "0.12.6" dependencies = [ "actix-web", "argon2rs", @@ -3131,7 +3131,7 @@ dependencies = [ [[package]] name = "thoth-api-server" -version = "0.12.5" +version = "0.12.6" dependencies = [ "actix-cors", "actix-identity", @@ -3147,7 +3147,7 @@ dependencies = [ [[package]] name = "thoth-app" -version = "0.12.5" +version = "0.12.6" dependencies = [ "anyhow", "chrono", @@ -3176,7 +3176,7 @@ dependencies = [ [[package]] name = "thoth-app-server" -version = "0.12.5" +version = "0.12.6" dependencies = [ "actix-cors", "actix-web", @@ -3186,7 +3186,7 @@ dependencies = [ [[package]] name = "thoth-client" -version = "0.12.5" +version = "0.12.6" dependencies = [ "chrono", "graphql_client", @@ -3202,7 +3202,7 @@ dependencies = [ [[package]] name = "thoth-errors" -version = "0.12.5" +version = "0.12.6" dependencies = [ "actix-web", "csv", @@ -3223,7 +3223,7 @@ dependencies = [ [[package]] name = "thoth-export-server" -version = "0.12.5" +version = "0.12.6" dependencies = [ "actix-cors", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index 5deb2a6da..6fde99182 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" } members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"] [dependencies] -thoth-api = { version = "=0.12.5", path = "thoth-api", features = ["backend"] } -thoth-api-server = { version = "=0.12.5", path = "thoth-api-server" } -thoth-app-server = { version = "=0.12.5", path = "thoth-app-server" } -thoth-errors = { version = "=0.12.5", path = "thoth-errors" } -thoth-export-server = { version = "=0.12.5", path = "thoth-export-server" } +thoth-api = { version = "=0.12.6", path = "thoth-api", features = ["backend"] } +thoth-api-server = { version = "=0.12.6", path = "thoth-api-server" } +thoth-app-server = { version = "=0.12.6", path = "thoth-app-server" } +thoth-errors = { version = "=0.12.6", path = "thoth-errors" } +thoth-export-server = { version = "=0.12.6", path = "thoth-export-server" } clap = { version = "4.4.7", features = ["cargo", "env"] } dialoguer = { version = "0.11.0", features = ["password"] } dotenv = "0.15.0" diff --git a/thoth-api-server/Cargo.toml b/thoth-api-server/Cargo.toml index c903130df..723e8897a 100644 --- a/thoth-api-server/Cargo.toml +++ b/thoth-api-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api-server" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth" readme = "README.md" [dependencies] -thoth-api = { version = "=0.12.5", path = "../thoth-api", features = ["backend"] } -thoth-errors = { version = "=0.12.5", path = "../thoth-errors" } +thoth-api = { version = "=0.12.6", path = "../thoth-api", features = ["backend"] } +thoth-errors = { version = "=0.12.6", path = "../thoth-errors" } actix-web = "4.5.1" actix-cors = "0.7.0" actix-identity = "0.7.1" diff --git a/thoth-api/Cargo.toml b/thoth-api/Cargo.toml index 36b499068..0d3950ac4 100644 --- a/thoth-api/Cargo.toml +++ b/thoth-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" } backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web", "jsonwebtoken"] [dependencies] -thoth-errors = { version = "=0.12.5", path = "../thoth-errors" } +thoth-errors = { version = "=0.12.6", path = "../thoth-errors" } actix-web = { version = "4.5.1", optional = true } argon2rs = "0.2.5" isbn2 = "0.4.0" diff --git a/thoth-app-server/Cargo.toml b/thoth-app-server/Cargo.toml index a6feef829..7f8117672 100644 --- a/thoth-app-server/Cargo.toml +++ b/thoth-app-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app-server" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" diff --git a/thoth-app/Cargo.toml b/thoth-app/Cargo.toml index 90a4bae36..dda6c9da0 100644 --- a/thoth-app/Cargo.toml +++ b/thoth-app/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -36,8 +36,8 @@ uuid = { version = "0.8.2", features = ["serde", "v4"] } # `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm # https://docs.rs/getrandom/latest/getrandom/#webassembly-support getrandom = { version = "0.2", features = ["js"] } -thoth-api = { version = "=0.12.5", path = "../thoth-api" } -thoth-errors = { version = "=0.12.5", path = "../thoth-errors" } +thoth-api = { version = "=0.12.6", path = "../thoth-api" } +thoth-errors = { version = "=0.12.6", path = "../thoth-errors" } [build-dependencies] dotenv = "0.15.0" diff --git a/thoth-client/Cargo.toml b/thoth-client/Cargo.toml index 55efd79e2..284a9b7f4 100644 --- a/thoth-client/Cargo.toml +++ b/thoth-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-client" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -10,8 +10,8 @@ readme = "README.md" build = "build.rs" [dependencies] -thoth-api = {version = "=0.12.5", path = "../thoth-api" } -thoth-errors = {version = "=0.12.5", path = "../thoth-errors" } +thoth-api = {version = "=0.12.6", path = "../thoth-api" } +thoth-errors = {version = "=0.12.6", path = "../thoth-errors" } graphql_client = "0.13.0" chrono = { version = "0.4.31", features = ["serde"] } reqwest = { version = "0.11", features = ["json"] } @@ -22,4 +22,4 @@ serde_json = "1.0" uuid = { version = "0.8.2", features = ["serde"] } [build-dependencies] -thoth-api = { version = "=0.12.5", path = "../thoth-api", features = ["backend"] } +thoth-api = { version = "=0.12.6", path = "../thoth-api", features = ["backend"] } diff --git a/thoth-errors/Cargo.toml b/thoth-errors/Cargo.toml index a52ead6ec..ec38e51fa 100644 --- a/thoth-errors/Cargo.toml +++ b/thoth-errors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-errors" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" diff --git a/thoth-export-server/Cargo.toml b/thoth-export-server/Cargo.toml index 227996987..d5af23e6b 100644 --- a/thoth-export-server/Cargo.toml +++ b/thoth-export-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-export-server" -version = "0.12.5" +version = "0.12.6" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -10,9 +10,9 @@ readme = "README.md" build = "build.rs" [dependencies] -thoth-api = { version = "=0.12.5", path = "../thoth-api" } -thoth-errors = { version = "=0.12.5", path = "../thoth-errors" } -thoth-client = { version = "=0.12.5", path = "../thoth-client" } +thoth-api = { version = "=0.12.6", path = "../thoth-api" } +thoth-errors = { version = "=0.12.6", path = "../thoth-errors" } +thoth-client = { version = "=0.12.6", path = "../thoth-client" } actix-web = "4.5.1" actix-cors = "0.7.0" cc_license = "0.1.0" From e9517387abbb33bc6fec2afad1bfcc0f8d29b07b Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 17 Jun 2024 15:24:57 +0100 Subject: [PATCH 9/9] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c745bde0..91e9dec71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [[0.12.6]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.6) - 2024-06-17 ### Fixed - [#513](https://github.com/thoth-pub/thoth/issues/513) - Expand DOI regex to include `+`, `[`, and `]`