From 872216c3d238d843de4ae02f869fdfd576ff395e Mon Sep 17 00:00:00 2001 From: alcroito Date: Sun, 24 Sep 2023 17:19:38 +0200 Subject: [PATCH 1/4] build: Use nextest cargo test runner in CI Supports retries for flaky failures. Use 3 retries. Also limit the db test to run in a separate process, so that diesel_migration harness doesn't fail with an I/O error. --- .config/nextest.toml | 16 ++++++++++++++++ .github/workflows/ci.yaml | 7 +++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 .config/nextest.toml diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 0000000..eba2aaa --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,16 @@ +[profile.ci] +# Don't fail fast in CI to run the full test suite. +fail-fast = false +failure-output = "immediate-final" +retries = 3 + +[test-groups] +serial-integration = { max-threads = 1 } + +[[profile.default.overrides]] +filter = 'test(db::logic::tests::test_do_ops_with_db)' +test-group = 'serial-integration' + +[[profile.ci.overrides]] +filter = 'test(db::logic::tests::test_do_ops_with_db)' +test-group = 'serial-integration' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7be33a2..7f48d5e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -164,8 +164,11 @@ jobs: - name: Create dummy web artifacts run: mkdir -p webclients/svelte/build - - name: Run cargo test - run: cargo test ${{ matrix.features && '--features' }} ${{ matrix.features }} ${{ matrix.release && '--release' || '' }} ${{ matrix.no_default_features && '--no-default-features' || '' }} ${{ matrix.all_features && '--all-features' || '' }} + - name: Install latest nextest release + uses: taiki-e/install-action@nextest + + - name: Run cargo nextest + run: cargo nextest run --profile ci ${{ matrix.features && '--features' }} ${{ matrix.features }} ${{ matrix.release && '--release' || '' }} ${{ matrix.no_default_features && '--no-default-features' || '' }} ${{ matrix.all_features && '--all-features' || '' }} env: RUST_BACKTRACE: full From af35c851e6e35c6264e140a9a12756a0807a3522 Mon Sep 17 00:00:00 2001 From: alcroito Date: Sun, 24 Sep 2023 17:40:54 +0200 Subject: [PATCH 2/4] chore: Bump edition to 2021 and package resolver to version 2 --- Cargo.toml | 1 + crates/dyndns/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f2eee56..b808b99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "crates/dyndns", diff --git a/crates/dyndns/Cargo.toml b/crates/dyndns/Cargo.toml index 0d7daee..a67a727 100644 --- a/crates/dyndns/Cargo.toml +++ b/crates/dyndns/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "digitalocean-dyndns" version = "0.1.0" -edition = "2018" +edition = "2021" description = "Dynamic DNS using DigitalOcean's DNS API" readme = "README.md" repository = "https://github.com/alcroito/digitalocean-dyndns" From e569f97cc0a66ecaeaf2efdf1cb302404f6b20a2 Mon Sep 17 00:00:00 2001 From: alcroito Date: Sun, 24 Sep 2023 17:48:27 +0200 Subject: [PATCH 3/4] chore: Bump crate and web package version numbers --- Cargo.lock | 2 +- crates/dyndns/Cargo.toml | 2 +- webclients/svelte/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d337673..91ba52a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -670,7 +670,7 @@ dependencies = [ [[package]] name = "digitalocean-dyndns" -version = "0.1.0" +version = "0.6.0" dependencies = [ "aide", "anyhow", diff --git a/crates/dyndns/Cargo.toml b/crates/dyndns/Cargo.toml index a67a727..47a6a05 100644 --- a/crates/dyndns/Cargo.toml +++ b/crates/dyndns/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "digitalocean-dyndns" -version = "0.1.0" +version = "0.6.0" edition = "2021" description = "Dynamic DNS using DigitalOcean's DNS API" readme = "README.md" diff --git a/webclients/svelte/package.json b/webclients/svelte/package.json index 262c5d8..0253609 100644 --- a/webclients/svelte/package.json +++ b/webclients/svelte/package.json @@ -1,6 +1,6 @@ { "name": "ddns", - "version": "0.0.1", + "version": "0.6.0", "private": true, "scripts": { "dev": "vite dev", From 91534d72a44a9b7d96dd7125974096c9a3ed5f03 Mon Sep 17 00:00:00 2001 From: alcroito Date: Sun, 24 Sep 2023 17:51:33 +0200 Subject: [PATCH 4/4] chore: Fix typo everywhere from zodius to zodios --- webclients/svelte/package.json | 2 +- .../src/generated/{zodiusClient.ts => zodiosClient.ts} | 0 .../svelte/src/services/{zodius.ts => zodios.ts} | 10 +++++----- .../svelte/src/stores/DomainRecordIpChangesStore.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) rename webclients/svelte/src/generated/{zodiusClient.ts => zodiosClient.ts} (100%) rename webclients/svelte/src/services/{zodius.ts => zodios.ts} (50%) diff --git a/webclients/svelte/package.json b/webclients/svelte/package.json index 0253609..fe68e31 100644 --- a/webclients/svelte/package.json +++ b/webclients/svelte/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "vite dev", - "apigen": "openapi-zod-client ../../crates/dyndns/generated/openapi.json -o ./src/generated/zodiusClient.ts --default-status auto-correct", + "apigen": "openapi-zod-client ../../crates/dyndns/generated/openapi.json -o ./src/generated/zodiosClient.ts --default-status auto-correct", "build": "vite build", "watch": "vite build -w", "preview": "vite preview", diff --git a/webclients/svelte/src/generated/zodiusClient.ts b/webclients/svelte/src/generated/zodiosClient.ts similarity index 100% rename from webclients/svelte/src/generated/zodiusClient.ts rename to webclients/svelte/src/generated/zodiosClient.ts diff --git a/webclients/svelte/src/services/zodius.ts b/webclients/svelte/src/services/zodios.ts similarity index 50% rename from webclients/svelte/src/services/zodius.ts rename to webclients/svelte/src/services/zodios.ts index f6b1144..44cc1cc 100644 --- a/webclients/svelte/src/services/zodius.ts +++ b/webclients/svelte/src/services/zodios.ts @@ -1,14 +1,14 @@ -import { api as zodiusClientDefault, createApiClient } from '../generated/zodiusClient'; +import { api as zodiosClientDefault, createApiClient } from '../generated/zodiosClient'; const createClient = () => { - let zodiusClient = zodiusClientDefault; + let zodiosClient = zodiosClientDefault; // Set in non-git-controlled .env.development file in the base dir of the web app // pointing to http://localhost:8095/. Use for API requests when running // vite dev. if (import.meta.env.VITE_SERVER_API_BASE_URL) { - zodiusClient = createApiClient(import.meta.env.VITE_SERVER_API_BASE_URL); + zodiosClient = createApiClient(import.meta.env.VITE_SERVER_API_BASE_URL); } - return zodiusClient; + return zodiosClient; }; -export const zodiusClient = createClient(); +export const zodiosClient = createClient(); diff --git a/webclients/svelte/src/stores/DomainRecordIpChangesStore.ts b/webclients/svelte/src/stores/DomainRecordIpChangesStore.ts index 76f75ff..fece609 100644 --- a/webclients/svelte/src/stores/DomainRecordIpChangesStore.ts +++ b/webclients/svelte/src/stores/DomainRecordIpChangesStore.ts @@ -3,8 +3,8 @@ import axios from 'axios'; import { createQuery, QueryClient } from '@tanstack/svelte-query'; import { defer, delay, firstValueFrom, TimeoutError } from 'rxjs'; import type { z } from 'zod'; -import type { schemas } from '../generated/zodiusClient'; -import { zodiusClient } from '../services/zodius'; +import type { schemas } from '../generated/zodiosClient'; +import { zodiosClient } from '../services/zodios'; type DomainRecordIpChange = z.infer; type DomainRecordIpChanges = { @@ -27,7 +27,7 @@ export class DomainRecordIpChangesStore { private queryFn() { const route = '/api/v1/domain_record_ip_changes'; - const obs = defer(() => zodiusClient.get(route)).pipe(delay(500)); + const obs = defer(() => zodiosClient.get(route)).pipe(delay(500)); const promise = firstValueFrom(obs); return promise; }