This commit is contained in:
Mingliang Tao 2020-08-04 16:52:22 +08:00 коммит произвёл GitHub
Родитель dac9dec8e0
Коммит a38216f57d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 2342 добавлений и 102 удалений

91
.github/workflows/docker_build.yml поставляемый
Просмотреть файл

@ -1,91 +0,0 @@
name: Docker Build
on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: webportal
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Test rest server compose
run: |
[ "${{github.event_name}}" == "pull_request" ] && export VERSION="${{github.head_ref}}"
[ "${{github.event_name}}" != "pull_request" ] && export VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo "branch name: ${VERSION}"
cd rest_server/deploy
docker-compose config
docker-compose up -d
sleep 5
curl http://localhost:3000
curl http://localhost:3000/items
- name: Test webportal image
run: |
[ "${{github.event_name}}" == "pull_request" ] && export VERSION="${{github.head_ref}}"
[ "${{github.event_name}}" != "pull_request" ] && export VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo "branch name: ${VERSION}"
cd webportal/deploy
docker build . --tag debuggy/image --build-arg VERSION=${BRANCH}
docker run -d -p 9292:9292 debuggy/image
sleep 5
curl http://localhost:9292/plugin.js
# Push image to GitHub Packages.
push:
# Ensure test job passes before pushing image.
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Build image
run: |
# Strip git ref prefix from version
export VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo "branch name: ${VERSION}"
cd webportal/deploy
docker build . --file Dockerfile --tag image --build-arg VERSION=${BRANCH}
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

6
.github/workflows/rest_server.yml поставляемый
Просмотреть файл

@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
node-version: [8.10.x, 10.x]
node-version: [10.x]
steps:
- uses: actions/checkout@v2
@ -26,5 +26,5 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: |
cd rest_server
yarn install
yarn lint
npm install
npm run lint

6
.github/workflows/webportal.yml поставляемый
Просмотреть файл

@ -26,6 +26,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: |
cd webportal
yarn install
yarn lint
yarn build
npm install
npm run lint
npm run build

2305
rest_server/package-lock.json сгенерированный Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -5,7 +5,7 @@
"author": "Microsoft",
"license": "MIT",
"engines": {
"node": "^8.10.0 || ^10"
"node": "^10"
},
"scripts": {
"lint": "eslint --ext .js --ext .jsx .",

Просмотреть файл

@ -1,6 +1,7 @@
{
"dependencies": {
"fs-extra": "^8.1.0",
"luxon": "^1.24.1",
"recursive-readdir": "^2.2.2"
}
}

23
tools/test.js Normal file
Просмотреть файл

@ -0,0 +1,23 @@
const { DateTime } = require("luxon");
const ms = 1596472735000;
function printDateTime(dt) {
console.log(dt)
console.log(dt.zoneName)
console.log(dt.locale)
if (
dt > DateTime.utc().minus({ week: 1 }) &&
dt < DateTime.utc().minus({ minute: 1 })
) {
console.log(dt.toRelative());
console.log(dt.toLocaleString(DateTime.TIME_24_WITH_LONG_OFFSET));
return `${dt.toRelative()}, ${dt.toLocaleString(DateTime.TIME_24_SIMPLE)}`;
} else {
return dt.toLocaleString(DateTime.DATETIME_MED);
}
}
const time = printDateTime(DateTime.fromMillis(ms));
console.log(time);

Просмотреть файл

@ -41,6 +41,11 @@ jsonfile@^4.0.0:
optionalDependencies:
graceful-fs "^4.1.6"
luxon@^1.24.1:
version "1.24.1"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.24.1.tgz#a8383266131ed4eaed4b5f430f96f3695403a52a"
integrity sha512-CgnIMKAWT0ghcuWFfCWBnWGOddM0zu6c4wZAWmD0NN7MZTnro0+833DF6tJep+xlxRPg4KtsYEHYLfTMBQKwYg==
minimatch@3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"

3
webportal/package-lock.json сгенерированный
Просмотреть файл

@ -9768,8 +9768,7 @@
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true,
"optional": true
"dev": true
},
"pify": {
"version": "4.0.1",

Просмотреть файл

@ -14,7 +14,6 @@ import PropTypes from 'prop-types';
import styled from 'styled-components';
import { capitalize } from 'lodash';
import { DateTime } from 'luxon';
import CircleIcon from 'App/components/circle_icon';
import { ReactComponent as DataIcon } from 'App/assets/data.svg';
import { ReactComponent as TemplateIcon } from 'App/assets/template.svg';
import VerticalLine from 'App/components/vertical_line';

Просмотреть файл

@ -6,7 +6,6 @@ import { Text, Stack } from 'office-ui-fabric-react';
import styled from 'styled-components';
import Card from 'App/components/card';
import CircleIcon from 'App/components/circle_icon';
import Context from 'App/context';
import { ReactComponent as DataIcon } from 'App/assets/data.svg';
import { ReactComponent as TemplateIcon } from 'App/assets/template.svg';