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

[build, ci] Fix offline db migrations check #8448

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 17 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,20 @@ jobs:
- name: build webapp
run: |
npm run build-packages
node webapp --disable-minify --app calendar
node webapp --disable-minify --app calendar

build-desktop: # will check that offline migrations are there
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
submodules: 'true'
- uses: "./.github/shared/setup"
- uses: "./.github/shared/setup-rust"
- uses: "./.github/shared/setup-emscripten"
with:
emscripten-version: ${{ env.emscripten_version }}
- name: build desktop
run: |
npm run build-packages
node desktop --disable-minify
3 changes: 3 additions & 0 deletions android.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { buildWebapp } from "./buildSrc/buildWebapp.js"
import { getTutanotaAppVersion, measure } from "./buildSrc/buildUtils.js"
import path from "node:path"
import { $, cd } from "zx"
import { checkOfflineDatabaseMigrations } from "./buildSrc/checkOfflineDbMigratons.js"

const log = (...messages) => console.log(chalk.green("\nBUILD:"), ...messages, "\n")

Expand Down Expand Up @@ -117,6 +118,8 @@ async function buildMailApk({ buildType }) {

async function buildAndroid({ stage, host, buildType, existing, webClient, app }) {
log(`Starting ${stage} build with build type: ${buildType}, webclient: ${webClient}, host: ${host}`)
await checkOfflineDatabaseMigrations()

if (!existing) {
if (webClient === "make") {
await runDevBuild({
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/checkOfflineDbMigratons.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ Please use them in ${MIGRATOR_PATH}`)

if (messages.length) {
const errorMessage = ["Failed check for offline db migrations! Errors:", ...messages].join("\n")
// throw new Error(errorMessage)
throw new Error(errorMessage)
}
}
1 change: 1 addition & 0 deletions ci/Ios.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def buildWebapp(String stage) {
sh "pwd"
sh "echo $PATH"
sh "npm ci"
sh "node buildSrc/checkOfflineDbMigratons.js"
sh 'npm run build-packages'
sh "node --max-old-space-size=8192 webapp ${stage}"
sh "node buildSrc/prepareMobileBuild.js dist"
Expand Down
4 changes: 3 additions & 1 deletion src/common/api/worker/offline/OfflineStorageMigrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import { tutanota79 } from "./migrations/tutanota-v79.js"
import { offline3 } from "./migrations/offline3"
import { sys118 } from "./migrations/sys-v118.js"
import { tutanota80 } from "./migrations/tutanota-v80.js"
import { storage11 } from "./migrations/storage-v11"
import { storage11 } from "./migrations/storage-v11.js"
import { sys119 } from "./migrations/sys-v119.js"

export interface OfflineMigration {
readonly app: VersionMetadataBaseKey
Expand Down Expand Up @@ -96,6 +97,7 @@ export const OFFLINE_STORAGE_MIGRATIONS: ReadonlyArray<OfflineMigration> = [
sys118,
tutanota80,
storage11,
sys119,
]

// in cases where the actual migration is not there anymore (we clean up old migrations no client would apply anymore)
Expand Down
12 changes: 12 additions & 0 deletions src/common/api/worker/offline/migrations/sys-v119.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { OfflineMigration } from "../OfflineStorageMigrator.js"
import { OfflineStorage } from "../OfflineStorage.js"
import { deleteInstancesOfType } from "../StandardMigrations.js"
import { CustomerInfoTypeRef } from "../../../entities/sys/TypeRefs"

export const sys119: OfflineMigration = {
app: "sys",
version: 119,
async migrate(storage: OfflineStorage) {
await deleteInstancesOfType(storage, CustomerInfoTypeRef)
},
}