Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/upgrade rust 1 78 0 #601

Merged
merged 8 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_test_and_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build binary
run: cargo build --verbose
run: cargo build -vv
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: cargo test --workspace --verbose
run: cargo test --workspace -vv
lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build binary
run: cargo build --verbose
run: cargo build -vv
- name: Run migrations
run: cargo run migrate
- name: Revert migrations
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ 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]
### Changed
- [601](https://github.com/thoth-pub/thoth/pull/601) - Upgrade rust to `1.78.0` in production and development `Dockerfile`
- [601](https://github.com/thoth-pub/thoth/pull/601) - Upgrade `trunk` to v0.20.0
- [601](https://github.com/thoth-pub/thoth/pull/601) - Added `-vv` option to build command in Makefile and GitHub actions

## [[0.12.4]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.4) - 2024-04-30
### Changed
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG MUSL_IMAGE=clux/muslrust:1.77.2-stable
ARG MUSL_IMAGE=clux/muslrust:1.78.0-stable

FROM ${MUSL_IMAGE} as build

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG RUST_VERSION=1.77.2
ARG RUST_VERSION=1.78.0

FROM rust:${RUST_VERSION}

ENV TRUNK_VERSION=0.18.8
ENV TRUNK_VERSION=0.20.0

ARG THOTH_GRAPHQL_API=http://localhost:8000
ARG THOTH_EXPORT_API=http://localhost:8181
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ docker-dev-db:
docker-compose -f docker-compose.dev.yml up db

build:
cargo build
cargo build -vv

build-graphql-api: build

Expand Down
2 changes: 1 addition & 1 deletion thoth-app-server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use dotenv::dotenv;
use std::env;
use std::process::{exit, Command};

const TRUNK_VERSION: &str = "0.19.2";
const TRUNK_VERSION: &str = "0.20.0";

fn is_wasm_target_installed() -> bool {
let output = Command::new("rustup")
Expand Down
2 changes: 2 additions & 0 deletions thoth-app/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ dist = "pkg"
public_url = "/admin/"
# Whether to include hash values in the output file names.
filehash = false
# Control minification
minify = "on_release" # can be one of: never, on_release, always

[clean]
# The output dir for all final assets.
Expand Down
12 changes: 9 additions & 3 deletions thoth-app/src/component/work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,15 @@ impl Component for WorkComponent {
self.doi = self.work.doi.clone().unwrap_or_default().to_string();
self.imprint_id = self.work.imprint.imprint_id;
self.work_type = self.work.work_type.clone();
self.data.imprints = body.data.imprints.to_owned();
self.data.work_types = body.data.work_types.enum_values.to_owned();
self.data.work_statuses = body.data.work_statuses.enum_values.to_owned();
body.data.imprints.clone_into(&mut self.data.imprints);
body.data
.work_types
.enum_values
.clone_into(&mut self.data.work_types);
body.data
.work_statuses
.enum_values
.clone_into(&mut self.data.work_statuses);

// If user doesn't have permission to edit this object, redirect to dashboard
if let Some(publishers) =
Expand Down
4 changes: 0 additions & 4 deletions thoth-app/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ pub trait ListString {
const BULLET_SEPARATOR: &'static str = " • ";
const COMMA_SEPARATOR: &'static str = ", ";

fn separated_list_item_bullet_small(&self) -> Html {
self.separated_list_item(true, Self::BULLET_SEPARATOR)
}

fn separated_list_item_comma(&self) -> Html {
self.separated_list_item(false, Self::COMMA_SEPARATOR)
}
Expand Down
44 changes: 22 additions & 22 deletions thoth-export-server/src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use paperclip::actix::web::HttpResponse;
use paperclip::actix::OperationModifier;
use paperclip::v2::models::{DefaultOperationRaw, Either, Response};
use paperclip::v2::schema::Apiv2Schema;
use std::fmt::Display;
use std::str::FromStr;
use thoth_client::Work;
use thoth_errors::{ThothError, ThothResult};
Expand Down Expand Up @@ -285,28 +286,27 @@ impl FromStr for MetadataSpecification {
}
}

impl ToString for MetadataSpecification {
fn to_string(&self) -> String {
match self {
MetadataSpecification::Onix3Thoth(_) => "onix_3.0::thoth".to_string(),
MetadataSpecification::Onix3ProjectMuse(_) => "onix_3.0::project_muse".to_string(),
MetadataSpecification::Onix3Oapen(_) => "onix_3.0::oapen".to_string(),
MetadataSpecification::Onix3Jstor(_) => "onix_3.0::jstor".to_string(),
MetadataSpecification::Onix3GoogleBooks(_) => "onix_3.0::google_books".to_string(),
MetadataSpecification::Onix3Overdrive(_) => "onix_3.0::overdrive".to_string(),
MetadataSpecification::Onix21EbscoHost(_) => "onix_2.1::ebsco_host".to_string(),
MetadataSpecification::Onix21ProquestEbrary(_) => {
"onix_2.1::proquest_ebrary".to_string()
}
MetadataSpecification::CsvThoth(_) => "csv::thoth".to_string(),
MetadataSpecification::JsonThoth(_) => "json::thoth".to_string(),
MetadataSpecification::KbartOclc(_) => "kbart::oclc".to_string(),
MetadataSpecification::BibtexThoth(_) => "bibtex::thoth".to_string(),
MetadataSpecification::DoiDepositCrossref(_) => "doideposit::crossref".to_string(),
MetadataSpecification::Marc21RecordThoth(_) => "marc21record::thoth".to_string(),
MetadataSpecification::Marc21MarkupThoth(_) => "marc21markup::thoth".to_string(),
MetadataSpecification::Marc21XmlThoth(_) => "marc21xml::thoth".to_string(),
}
impl Display for MetadataSpecification {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let str = match self {
MetadataSpecification::Onix3Thoth(_) => "onix_3.0::thoth",
MetadataSpecification::Onix3ProjectMuse(_) => "onix_3.0::project_muse",
MetadataSpecification::Onix3Oapen(_) => "onix_3.0::oapen",
MetadataSpecification::Onix3Jstor(_) => "onix_3.0::jstor",
MetadataSpecification::Onix3GoogleBooks(_) => "onix_3.0::google_books",
MetadataSpecification::Onix3Overdrive(_) => "onix_3.0::overdrive",
MetadataSpecification::Onix21EbscoHost(_) => "onix_2.1::ebsco_host",
MetadataSpecification::Onix21ProquestEbrary(_) => "onix_2.1::proquest_ebrary",
MetadataSpecification::CsvThoth(_) => "csv::thoth",
MetadataSpecification::JsonThoth(_) => "json::thoth",
MetadataSpecification::KbartOclc(_) => "kbart::oclc",
MetadataSpecification::BibtexThoth(_) => "bibtex::thoth",
MetadataSpecification::DoiDepositCrossref(_) => "doideposit::crossref",
MetadataSpecification::Marc21RecordThoth(_) => "marc21record::thoth",
MetadataSpecification::Marc21MarkupThoth(_) => "marc21markup::thoth",
MetadataSpecification::Marc21XmlThoth(_) => "marc21xml::thoth",
};
write!(f, "{}", str)
}
}

Expand Down
Loading