From 0952a37e86746167f43d44342e21f44f6d4b45d8 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Wed, 30 Aug 2023 16:54:42 +0200 Subject: [PATCH] Use build:debug and custom build environment docker image for CI --- .forgejo/workflows/test-build.yaml | 8 ++------ ci-env/Dockerfile | 4 ++++ package.json | 1 + packages/backend/native-utils/Cargo.toml | 6 ++++++ packages/backend/native-utils/package.json | 2 +- packages/backend/package.json | 1 + packages/client/package.json | 1 + packages/iceshrimp-js/package.json | 1 + packages/megalodon/package.json | 1 + packages/sw/package.json | 1 + 10 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 ci-env/Dockerfile diff --git a/.forgejo/workflows/test-build.yaml b/.forgejo/workflows/test-build.yaml index d36ea5847..52802790e 100644 --- a/.forgejo/workflows/test-build.yaml +++ b/.forgejo/workflows/test-build.yaml @@ -4,7 +4,7 @@ jobs: test-build: runs-on: docker container: - image: alpine:3.18 + image: iceshrimp.dev/iceshrimp/iceshrimp:ci-env options: --volume /opt/iceshrimp-cache/yarn:/iceshrimp-caches/yarn --volume /opt/iceshrimp-cache/cargo:/root/.cargo --volume /opt/iceshrimp-cache/built:/iceshrimp-caches/built --volume /opt/iceshrimp-cache/target:/iceshrimp-caches/target services: database: @@ -14,10 +14,6 @@ jobs: redis: image: redis steps: - - name: Set up build environment - run: | - apk add --no-cache --no-progress git alpine-sdk vips-dev python3 nodejs-current npm rust cargo vips - corepack enable && corepack prepare yarn@stable --activate - name: Clone repository run: git clone https://iceshrimp.dev/iceshrimp/iceshrimp.git --branch=${{ github.ref_name }} --depth=1 /iceshrimp - name: Install build dependencies @@ -31,7 +27,7 @@ jobs: cd /iceshrimp cp -Trp /iceshrimp-caches/built packages/backend/native-utils/built cp -Trp /iceshrimp-caches/target packages/backend/native-utils/target - yarn build + yarn build:debug rm -rf /iceshrimp-caches/built/* && cp -Trp packages/backend/native-utils/built /iceshrimp-caches/built rm -rf /iceshrimp-caches/target/* && cp -Trp packages/backend/native-utils/target /iceshrimp-caches/target - name: Test the shrimp diff --git a/ci-env/Dockerfile b/ci-env/Dockerfile new file mode 100644 index 000000000..cf0f1e861 --- /dev/null +++ b/ci-env/Dockerfile @@ -0,0 +1,4 @@ +FROM alpine:3.18 +RUN apk add --no-cache --no-progress git alpine-sdk vips-dev python3 nodejs-current npm rust cargo vips +RUN corepack enable && corepack prepare yarn@stable --activate +CMD ["/bin/sh"] diff --git a/package.json b/package.json index 945d2c0c1..edbec3f1b 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "rebuild": "clean && node ./scripts/build-greet.js && yarn workspace iceshrimp-js build && yarn workspaces foreach -pitv run build && gulp", "build": "node ./scripts/build-greet.js && yarn workspace iceshrimp-js run build && yarn workspaces foreach -pitv run build && gulp", + "build:debug": "node ./scripts/build-greet.js && yarn workspace iceshrimp-js run build:debug && yarn workspaces foreach -pitv run build:debug && gulp", "start": "yarn workspace backend run start", "start:test": "yarn workspace backend run start:test", "init": "yarn migrate", diff --git a/packages/backend/native-utils/Cargo.toml b/packages/backend/native-utils/Cargo.toml index 0d2718fd8..5f9827fbc 100644 --- a/packages/backend/native-utils/Cargo.toml +++ b/packages/backend/native-utils/Cargo.toml @@ -49,3 +49,9 @@ lto = true [profile.release-no-lto] inherits = "release" lto = false + +[profile.debug-napi] +inherits = "dev" + +[profile.debug-migration] +inherits = "dev" diff --git a/packages/backend/native-utils/package.json b/packages/backend/native-utils/package.json index 05623cc1f..1bf58c155 100644 --- a/packages/backend/native-utils/package.json +++ b/packages/backend/native-utils/package.json @@ -37,7 +37,7 @@ "build": "yarn build:napi && yarn build:migration", "build:napi": "napi build --features napi --platform --release ./built/", "build:migration": "cargo build --locked --profile release-no-lto -p migration && cp ./target/release-no-lto/migration ./built/migration", - "build:debug": "napi build --platform ./built/ && cargo build -p migration", + "build:debug": "napi build --features napi --platform --profile debug-napi ./built/ && cargo build --locked --profile debug-migration -p migration && cp ./target/debug-migration/migration ./built/migration", "prepublishOnly": "napi prepublish -t npm", "test": "yarn cargo:test && yarn build:napi && ava", "universal": "napi universal", diff --git a/packages/backend/package.json b/packages/backend/package.json index 8f52e033f..5b660f0cf 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -14,6 +14,7 @@ "revertmigration:cargo": "./native-utils/built/migration down", "check:connect": "node ./check_connect.js", "build": "swc src -d built -D", + "build:debug": "swc src -d built -s -D", "watch": "swc src -d built -D -w", "lint": "rome check --apply *", "mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", diff --git a/packages/client/package.json b/packages/client/package.json index cd350aaf8..9fc3d0c63 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -4,6 +4,7 @@ "scripts": { "watch": "vite build --watch --mode development", "build": "vite build", + "build:debug": "yarn build", "lint": "rome check **/*.ts --apply && yarn lint:vue", "lint:vue": "paralint --ext .vue --fix '**/*.vue' --cache", "format": "rome format * --write && prettier --write '**/*.{scss,vue}' --cache --cache-strategy metadata" diff --git a/packages/iceshrimp-js/package.json b/packages/iceshrimp-js/package.json index df9bb2991..661cf02ec 100644 --- a/packages/iceshrimp-js/package.json +++ b/packages/iceshrimp-js/package.json @@ -6,6 +6,7 @@ "types": "./built/index.d.ts", "scripts": { "build": "swc src -d built -D", + "build:debug": "swc src -d built -s -D", "render": "yarn build && yarn api && yarn api-prod && cp temp/iceshrimp-js.api.json etc/ && yarn api-doc", "tsd": "tsc && tsd", "api": "api-extractor run --local --verbose", diff --git a/packages/megalodon/package.json b/packages/megalodon/package.json index 6eca396e4..b5d466ed3 100644 --- a/packages/megalodon/package.json +++ b/packages/megalodon/package.json @@ -5,6 +5,7 @@ "typings": "./lib/src/index.d.ts", "scripts": { "build": "tsc -p ./", + "build:debug": "yarn build", "lint": "rome check **/*.ts --apply", "format": "rome format --write src/**/*.ts", "doc": "typedoc --out ../docs ./src", diff --git a/packages/sw/package.json b/packages/sw/package.json index d24796ebe..dee1ecd90 100644 --- a/packages/sw/package.json +++ b/packages/sw/package.json @@ -3,6 +3,7 @@ "private": true, "scripts": { "build": "webpack", + "build:debug": "yarn build", "watch": "swc src -d built -D -w", "lint": "rome check **/*.ts --apply", "format": "rome format * --write"