Compare commits

...

30 Commits
stage ... ci

Author SHA1 Message Date
Acid Chicken (硫酸鶏) 70a68045e2
Merge branch 'develop' of https://github.com/syuilo/misskey into ci 2019-07-02 04:21:08 +09:00
Acid Chicken (硫酸鶏) a9fc044837
Use misskey instead of test-misskey 2019-07-02 00:36:36 +09:00
Acid Chicken (硫酸鶏) d6a4cc872c
Use syuilo instead of admin 2019-07-02 00:28:16 +09:00
Acid Chicken (硫酸鶏) 31a3c4b272
Fix typo 2019-07-02 00:16:17 +09:00
Acid Chicken (硫酸鶏) 3bdf54164a
Add init before test 2019-07-02 00:05:43 +09:00
Acid Chicken (硫酸鶏) 62fde0587f
Add postgres env 2019-07-01 23:50:22 +09:00
Acid Chicken (硫酸鶏) 181f911ec6
Fix types 2019-07-01 23:37:21 +09:00
Acid Chicken (硫酸鶏) 609caf2c4b
FIx types 2019-07-01 23:36:07 +09:00
Acid Chicken (硫酸鶏) f514c1c200
Fix type 2019-07-01 23:35:45 +09:00
Acid Chicken (硫酸鶏) 0c0281d51d
Fix typo 2019-07-01 23:29:27 +09:00
Acid Chicken (硫酸鶏) f5972cabb3
Specify Record<string, unknown> 2019-07-01 23:07:54 +09:00
Acid Chicken (硫酸鶏) d22e21c597
Fix type 2019-07-01 22:44:29 +09:00
Acid Chicken (硫酸鶏) 7f2b829a89
Fix indent 2019-06-28 14:04:35 +09:00
Acid Chicken (硫酸鶏) dbc9461070
Follow 3f5b96bf62 2019-06-07 16:50:10 +09:00
Acid Chicken (硫酸鶏) 609d1b5e8b
Merge branch 'develop' into ci 2019-06-07 16:47:59 +09:00
Acid Chicken (硫酸鶏) 738858f261
Fix missing configurations 2019-05-12 23:31:04 +09:00
Acid Chicken (硫酸鶏) f71382516a
Update versions 2019-05-12 23:24:58 +09:00
Acid Chicken (硫酸鶏) 9037cc792a
Fix bug 2019-05-12 22:42:20 +09:00
Acid Chicken (硫酸鶏) 84b66bec6a
Re: Clean up 2019-05-12 22:40:10 +09:00
Acid Chicken (硫酸鶏) 680b307eb5
Revert "Fix tests"
This reverts commit c45b08d967.
2019-05-12 22:24:50 +09:00
Acid Chicken (硫酸鶏) c45b08d967
Fix tests 2019-05-12 22:12:52 +09:00
Acid Chicken (硫酸鶏) 2b3c11d8d9
Update names 2019-05-12 22:09:42 +09:00
Acid Chicken (硫酸鶏) 05a7653eb0
Fix missing parameters definition 2019-05-12 22:00:52 +09:00
Acid Chicken (硫酸鶏) 48862ef783
Auto abort incorrect target 2019-05-12 21:58:46 +09:00
Acid Chicken (硫酸鶏) b2c60fb513
Re: Clean up 2019-05-12 18:09:14 +09:00
Acid Chicken (硫酸鶏) be48df62b3
Fix typo 2019-05-12 18:06:06 +09:00
Acid Chicken (硫酸鶏) e5da1caffd
Update CircleCI configuration 2019-05-12 18:04:39 +09:00
Acid Chicken (硫酸鶏) b5e2a3bc55
Separate ways 2019-05-12 17:39:58 +09:00
Acid Chicken (硫酸鶏) 95f0c50c37
Revert "Clean up"
This reverts commit 7945eddef6.
2019-05-12 17:39:03 +09:00
Acid Chicken (硫酸鶏) 4612e4477d
Revert "Clean up"
This reverts commit 5a5b65e9bf.
2019-05-12 17:38:37 +09:00
19 changed files with 335 additions and 85 deletions

View File

@ -1,20 +1,61 @@
version: 2.1
executors:
default:
working_directory: /tmp/workspace
v11-node12:
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v11-node12
- image: circleci/postgres:latest
environment:
POSTGRES_USER: syuilo
POSTGRES_DB: misskey
- image: circleci/redis:latest
v11-node11:
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v11-node11
- image: circleci/redis:latest
- image: circleci/postgres:latest
docker:
working_directory: /tmp/workspace
environment:
POSTGRES_USER: syuilo
POSTGRES_DB: misskey
- image: circleci/redis:latest
v10-node11:
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: docker:latest
- image: misskey/ci:v10-node11
- image: circleci/mongo:latest
v10-node11-redis:
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v10-node11
- image: circleci/mongo:latest
v10-node10:
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v10-node10
- image: circleci/mongo:latest
- image: circleci/redis:latest
v10-node10-redis:
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v10-node10
- image: circleci/mongo:latest
- image: circleci/redis:latest
docker:
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:docker
jobs:
build:
executor: default
nodejs-build:
parameters:
executor:
type: string
default: "v11-node12"
target:
type: string
default: "v11"
executor: <<parameters.executor>>
steps:
- checkout
- run:
@ -36,13 +77,20 @@ jobs:
- run:
name: Configure
command: |
cp .circleci/misskey/default.yml .config
cp .circleci/misskey/test.yml .config
cp .circleci/<<parameters.executor>>/default.yml .config
cp .circleci/<<parameters.executor>>/test.yml .config
- run:
name: Build
command: |
yarn build
touch yarn.lock
excepted="<<parameters.target>>"
actual="v$(cat package.json | jq -r '.version' | awk -F. '{print $1}')"
if [ $excepted = $actual ]
then
yarn build
touch yarn.lock
else
echo -e '\033[0;33mBuild Aborted\033[0;39m'
fi
- save_cache:
name: Cache npm packages
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
@ -52,108 +100,188 @@ jobs:
root: .
paths:
- .
test:
nodejs-test:
parameters:
executor:
type: string
default: "default"
default: "v11-node12"
target:
type: string
default: "v11"
executor: <<parameters.executor>>
steps:
- attach_workspace:
at: /tmp/workspace
at: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
- run:
name: Test
command: |
yarn test
excepted="<<parameters.target>>"
actual="v$(cat package.json | jq -r '.version' | awk -F. '{print $1}')"
if [ $excepted = $actual ]
then
yarn run init || echo -e '\033[0;33mInitialization Not Required\033[0;39m'
yarn test
else
echo -e '\033[0;33mTest Aborted\033[0;39m'
fi
touch yarn.lock
- save_cache:
name: Cache npm packages
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths:
- node_modules
docker:
docker-build:
parameters:
with_deploy:
deploy:
type: boolean
default: false
executor: docker
steps:
- checkout
- setup_remote_docker
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Build
command: |
docker build -t misskey/misskey .
- when:
condition: <<parameters.with_deploy>>
condition: <<parameters.deploy>>
steps:
- run:
name: Deploy
command: |
if [ "$DOCKERHUB_USERNAME$DOCKERHUB_PASSWORD" ]
then
apk update && apk add jq
docker tag misskey/misskey misskey/misskey:$(cat package.json | jq -r .version)
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker push misskey/misskey
else
echo -e '\033[0;33mAborted deploying to Docker Hub\033[0;39m'
then
docker tag misskey/misskey misskey/misskey:$(cat package.json | jq -r .version)
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker push misskey/misskey
else
echo -e '\033[0;33mDeploy Aborted\033[0;39m'
fi
docker-ok:
executor: docker
steps:
- run:
name: OK
command: |
echo -e '\033[0;32mOK\033[0;39m'
workflows:
version: 2
nodejs:
jobs:
- hold:
name: manual-build-trigger
type: approval
- nodejs-build:
name: build-v11-node12
executor: v11-node12
target: v11
filters:
branches:
ignore: master
- build:
name: manual-build
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: test-v11-node12
executor: v11-node12
target: v11
requires:
- manual-build-trigger
- build-v11-node12
- nodejs-build:
name: build-v11-node11
executor: v11-node11
target: v11
filters:
branches:
ignore: master
- build:
name: auto-build
filters:
branches:
only: master
- test:
name: manual-test
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: test-v11-node11
executor: v11-node11
target: v11
requires:
- manual-build
- build-v11-node11
- nodejs-build:
name: build-v10-node11
executor: v10-node11
target: v10
filters:
branches:
ignore: master
- test:
name: auto-test
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: test-v10-node11
executor: v10-node11
target: v10
requires:
- auto-build
- build-v10-node11
- nodejs-build:
name: build-v10-node11-redis
executor: v10-node11-redis
target: v10
filters:
branches:
only: master
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: test-v10-node11-redis
executor: v10-node11-redis
target: v10
requires:
- build-v10-node11-redis
- nodejs-build:
name: build-v10-node10
executor: v10-node10
target: v10
filters:
branches:
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: test-v10-node10
executor: v10-node10
target: v10
requires:
- build-v10-node10
- nodejs-build:
name: build-v10-node10-redis
executor: v10-node10-redis
target: v10
filters:
branches:
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: test-v10-node10-redis
executor: v10-node10-redis
target: v10
requires:
- build-v10-node10-redis
docker:
jobs:
- hold:
name: manual-build-trigger
type: approval
- docker-ok:
name: skip-docker
filters:
branches:
ignore: master
- docker:
name: manual-build
requires:
- manual-build-trigger
filters:
branches:
ignore: master
- docker:
name: auto-build
with_deploy: true
- docker-build:
name: deploy-docker
deploy: true
filters:
branches:
only: master

View File

@ -0,0 +1,14 @@
url: 'http://misskey.local'
port: 80
mongodb:
host: localhost
port: 27017
db: misskey
user: syuilo
pass: ''
drive:
storage: 'db'
redis:
host: localhost
port: 6379
pass: ''

View File

@ -0,0 +1,10 @@
url: 'http://misskey.local'
port: 80
mongodb:
host: localhost
port: 27017
db: misskey
user: syuilo
pass: ''
drive:
storage: 'db'

View File

@ -0,0 +1,10 @@
url: 'http://misskey.local'
port: 80
mongodb:
host: localhost
port: 27017
db: misskey
user: syuilo
pass: ''
drive:
storage: 'db'

View File

@ -0,0 +1,14 @@
url: 'http://misskey.local'
port: 80
mongodb:
host: localhost
port: 27017
db: misskey
user: syuilo
pass: ''
drive:
storage: 'db'
redis:
host: localhost
port: 6379
pass: ''

View File

@ -3,8 +3,8 @@ port: 80
mongodb:
host: localhost
port: 27017
db: test-misskey
user: admin
db: misskey
user: syuilo
pass: ''
# __REDIS__
redis:

View File

@ -0,0 +1,10 @@
url: 'http://misskey.local'
port: 80
mongodb:
host: localhost
port: 27017
db: misskey
user: syuilo
pass: ''
drive:
storage: 'db'

View File

@ -0,0 +1,10 @@
url: 'http://misskey.local'
port: 80
mongodb:
host: localhost
port: 27017
db: misskey
user: syuilo
pass: ''
drive:
storage: 'db'

View File

@ -0,0 +1,13 @@
url: 'http://misskey.local'
port: 80
db:
host: localhost
port: 5432
db: misskey
user: syuilo
pass: ''
redis:
host: localhost
port: 6379
pass: ''
id: 'aid'

View File

@ -0,0 +1,13 @@
url: 'http://misskey.local'
port: 80
db:
host: localhost
port: 5432
db: misskey
user: syuilo
pass: ''
redis:
host: localhost
port: 6379
pass: ''
id: 'aid'

View File

@ -0,0 +1,13 @@
url: 'http://misskey.local'
port: 80
db:
host: localhost
port: 5432
db: misskey
user: syuilo
pass: ''
redis:
host: localhost
port: 6379
pass: ''
id: 'aid'

View File

@ -0,0 +1,13 @@
url: 'http://misskey.local'
port: 80
db:
host: localhost
port: 5432
db: misskey
user: syuilo
pass: ''
redis:
host: localhost
port: 6379
pass: ''
id: 'aid'

View File

@ -5,12 +5,12 @@ import { genMeidg } from './id/meidg';
import { genObjectId } from './id/object-id';
import config from '../config';
const metohd = config.id.toLowerCase();
const method = config.id.toLowerCase();
export function genId(date?: Date): string {
if (!date || (date > new Date())) date = new Date();
switch (metohd) {
switch (method) {
case 'aid': return genAid(date);
case 'meid': return genMeid(date);
case 'meidg': return genMeidg(date);

View File

@ -217,7 +217,7 @@ export class Note {
public renoteUserHost: string | null;
//#endregion
constructor(data: Partial<Note>) {
constructor(data?: Partial<Note> | null) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@ -6,7 +6,7 @@ import { parse } from '../src/mfm/parse';
describe('Extract mentions', () => {
it('simple', () => {
const ast = parse('@foo @bar @baz');
const mentions = extractMentions(ast);
const mentions = extractMentions(ast!);
assert.deepStrictEqual(mentions, [{
username: 'foo',
acct: '@foo',
@ -27,7 +27,7 @@ describe('Extract mentions', () => {
it('nested', () => {
const ast = parse('@foo **@bar** @baz');
const mentions = extractMentions(ast);
const mentions = extractMentions(ast!);
assert.deepStrictEqual(mentions, [{
username: 'foo',
acct: '@foo',

View File

@ -62,8 +62,8 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === bobNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === carolNote.id), false);
}));
it('ミュートしているユーザーからメンションされても、hasUnreadMentions が true にならない', async(async () => {
@ -131,9 +131,9 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === bobNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === carolNote.id), false);
}));
it('タイムラインにミュートしているユーザーの投稿のRenoteが含まれない', async(async () => {
@ -147,9 +147,9 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === bobNote.id), false);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === carolNote.id), false);
}));
});
@ -163,8 +163,8 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(notification => notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => notification.userId === carol.id), false);
assert.strictEqual(res.body.some((notification: Record<string, unknown>) => notification.userId === bob.id), true);
assert.strictEqual(res.body.some((notification: Record<string, unknown>) => notification.userId === carol.id), false);
}));
});
});

View File

@ -16,9 +16,11 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
import { Connection } from 'typeorm';
import { async, signup, request, post, uploadFile } from './utils';
import { Note } from '../built/models/entities/note';
const initDb = require('../built/db/postgre.js').initDb;
const { Note }: { Note: new () => unknown } = require('../built/models/entities/note');
// tslint:disable-next-line: bool-param-default
const { initDb }: { initDb(justBorrow?: boolean, sync?: boolean, log?: boolean): Promise<Connection> } = require('../built/db/postgre.js');
describe('Note', () => {
let p: childProcess.ChildProcess;

View File

@ -66,8 +66,8 @@ describe('users/notes', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.length, 2);
assert.strictEqual(res.body.some(note => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some(note => note.id === jpgPngNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === jpgPngNote.id), true);
}));
it('ファイルタイプ指定 (jpg or png)', async(async () => {
@ -79,8 +79,8 @@ describe('users/notes', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.length, 3);
assert.strictEqual(res.body.some(note => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some(note => note.id === pngNote.id), true);
assert.strictEqual(res.body.some(note => note.id === jpgPngNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === pngNote.id), true);
assert.strictEqual(res.body.some((note: Record<string, unknown>) => note.id === jpgPngNote.id), true);
}));
});