mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 13:36:30 +03:00
Check provider database with CI
scripts/update-provider-database.sh checks out the provider database and updates data.rs file, making it easier to update. CI uses this script to check that checked in data.rs corresponds to the provider database repository.
This commit is contained in:
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -41,6 +41,14 @@ jobs:
|
||||
with:
|
||||
arguments: --all-features --workspace
|
||||
|
||||
provider_database:
|
||||
name: Check provider database
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check provider database
|
||||
run: scripts/update-provider-database.sh
|
||||
|
||||
docs:
|
||||
name: Rust doc comments
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
- Make smeared timestamp generation non-async. #4075
|
||||
- Set minimum TLS version to 1.2. #4096
|
||||
- Run `cargo-deny` in CI. #4101
|
||||
- Check provider database with CI. #4099
|
||||
|
||||
### Fixes
|
||||
- Do not block async task executor while decrypting the messages. #4079
|
||||
|
||||
@@ -201,7 +201,10 @@ if __name__ == "__main__":
|
||||
out_all += out_ids;
|
||||
out_all += "].iter().copied().collect());\n\n"
|
||||
|
||||
now = datetime.datetime.utcnow()
|
||||
if len(sys.argv) < 3:
|
||||
now = datetime.datetime.utcnow()
|
||||
else:
|
||||
now = datetime.datetime.fromisoformat(sys.argv[2])
|
||||
out_all += "pub static PROVIDER_UPDATED: Lazy<chrono::NaiveDate> = "\
|
||||
"Lazy::new(|| chrono::NaiveDate::from_ymd_opt("+str(now.year)+", "+str(now.month)+", "+str(now.day)+").unwrap());\n"
|
||||
|
||||
22
scripts/update-provider-database.sh
Executable file
22
scripts/update-provider-database.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Updates provider database.
|
||||
# Returns 1 if the database is changed, 0 otherwise.
|
||||
set -euo pipefail
|
||||
|
||||
export TZ=UTC
|
||||
|
||||
# Provider database revision.
|
||||
REV=3c8f7e846c915a183dc44536fb5480d1f25d7c42
|
||||
|
||||
CORE_ROOT="$PWD"
|
||||
TMP="$(mktemp -d)"
|
||||
git clone --filter=blob:none https://github.com/deltachat/provider-db.git "$TMP"
|
||||
cd "$TMP"
|
||||
git checkout "$REV"
|
||||
DATE=$(git show -s --format=%cs)
|
||||
"$CORE_ROOT"/scripts/update-provider-database.py "$TMP/_providers" "$DATE" >"$CORE_ROOT/src/provider/data.rs"
|
||||
rustfmt "$CORE_ROOT/src/provider/data.rs"
|
||||
rm -fr "$TMP"
|
||||
|
||||
cd "$CORE_ROOT"
|
||||
test -z "$(git status --porcelain src/provider/data.rs)"
|
||||
@@ -1952,4 +1952,4 @@ pub(crate) static PROVIDER_IDS: Lazy<HashMap<&'static str, &'static Provider>> =
|
||||
});
|
||||
|
||||
pub static PROVIDER_UPDATED: Lazy<chrono::NaiveDate> =
|
||||
Lazy::new(|| chrono::NaiveDate::from_ymd_opt(2023, 2, 21).unwrap());
|
||||
Lazy::new(|| chrono::NaiveDate::from_ymd_opt(2023, 2, 20).unwrap());
|
||||
|
||||
Reference in New Issue
Block a user