Use build:debug and custom build environment docker image for CI

This commit is contained in:
Laura Hausmann 2023-08-30 16:54:42 +02:00
parent 66ab00a174
commit 0952a37e86
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
10 changed files with 19 additions and 7 deletions

View File

@ -4,7 +4,7 @@ jobs:
test-build: test-build:
runs-on: docker runs-on: docker
container: 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 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: services:
database: database:
@ -14,10 +14,6 @@ jobs:
redis: redis:
image: redis image: redis
steps: 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 - name: Clone repository
run: git clone https://iceshrimp.dev/iceshrimp/iceshrimp.git --branch=${{ github.ref_name }} --depth=1 /iceshrimp run: git clone https://iceshrimp.dev/iceshrimp/iceshrimp.git --branch=${{ github.ref_name }} --depth=1 /iceshrimp
- name: Install build dependencies - name: Install build dependencies
@ -31,7 +27,7 @@ jobs:
cd /iceshrimp cd /iceshrimp
cp -Trp /iceshrimp-caches/built packages/backend/native-utils/built cp -Trp /iceshrimp-caches/built packages/backend/native-utils/built
cp -Trp /iceshrimp-caches/target packages/backend/native-utils/target 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/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 rm -rf /iceshrimp-caches/target/* && cp -Trp packages/backend/native-utils/target /iceshrimp-caches/target
- name: Test the shrimp - name: Test the shrimp

4
ci-env/Dockerfile Normal file
View File

@ -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"]

View File

@ -10,6 +10,7 @@
"scripts": { "scripts": {
"rebuild": "clean && node ./scripts/build-greet.js && yarn workspace iceshrimp-js build && yarn workspaces foreach -pitv run build && gulp", "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": "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": "yarn workspace backend run start",
"start:test": "yarn workspace backend run start:test", "start:test": "yarn workspace backend run start:test",
"init": "yarn migrate", "init": "yarn migrate",

View File

@ -49,3 +49,9 @@ lto = true
[profile.release-no-lto] [profile.release-no-lto]
inherits = "release" inherits = "release"
lto = false lto = false
[profile.debug-napi]
inherits = "dev"
[profile.debug-migration]
inherits = "dev"

View File

@ -37,7 +37,7 @@
"build": "yarn build:napi && yarn build:migration", "build": "yarn build:napi && yarn build:migration",
"build:napi": "napi build --features napi --platform --release ./built/", "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: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", "prepublishOnly": "napi prepublish -t npm",
"test": "yarn cargo:test && yarn build:napi && ava", "test": "yarn cargo:test && yarn build:napi && ava",
"universal": "napi universal", "universal": "napi universal",

View File

@ -14,6 +14,7 @@
"revertmigration:cargo": "./native-utils/built/migration down", "revertmigration:cargo": "./native-utils/built/migration down",
"check:connect": "node ./check_connect.js", "check:connect": "node ./check_connect.js",
"build": "swc src -d built -D", "build": "swc src -d built -D",
"build:debug": "swc src -d built -s -D",
"watch": "swc src -d built -D -w", "watch": "swc src -d built -D -w",
"lint": "rome check --apply *", "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", "mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha",

View File

@ -4,6 +4,7 @@
"scripts": { "scripts": {
"watch": "vite build --watch --mode development", "watch": "vite build --watch --mode development",
"build": "vite build", "build": "vite build",
"build:debug": "yarn build",
"lint": "rome check **/*.ts --apply && yarn lint:vue", "lint": "rome check **/*.ts --apply && yarn lint:vue",
"lint:vue": "paralint --ext .vue --fix '**/*.vue' --cache", "lint:vue": "paralint --ext .vue --fix '**/*.vue' --cache",
"format": "rome format * --write && prettier --write '**/*.{scss,vue}' --cache --cache-strategy metadata" "format": "rome format * --write && prettier --write '**/*.{scss,vue}' --cache --cache-strategy metadata"

View File

@ -6,6 +6,7 @@
"types": "./built/index.d.ts", "types": "./built/index.d.ts",
"scripts": { "scripts": {
"build": "swc src -d built -D", "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", "render": "yarn build && yarn api && yarn api-prod && cp temp/iceshrimp-js.api.json etc/ && yarn api-doc",
"tsd": "tsc && tsd", "tsd": "tsc && tsd",
"api": "api-extractor run --local --verbose", "api": "api-extractor run --local --verbose",

View File

@ -5,6 +5,7 @@
"typings": "./lib/src/index.d.ts", "typings": "./lib/src/index.d.ts",
"scripts": { "scripts": {
"build": "tsc -p ./", "build": "tsc -p ./",
"build:debug": "yarn build",
"lint": "rome check **/*.ts --apply", "lint": "rome check **/*.ts --apply",
"format": "rome format --write src/**/*.ts", "format": "rome format --write src/**/*.ts",
"doc": "typedoc --out ../docs ./src", "doc": "typedoc --out ../docs ./src",

View File

@ -3,6 +3,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"build": "webpack", "build": "webpack",
"build:debug": "yarn build",
"watch": "swc src -d built -D -w", "watch": "swc src -d built -D -w",
"lint": "rome check **/*.ts --apply", "lint": "rome check **/*.ts --apply",
"format": "rome format * --write" "format": "rome format * --write"