-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #345 from ArtalkJS/refactor/bump-to-monorepo
fefactor: bump to monorepo
- Loading branch information
Showing
432 changed files
with
20,940 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
node: circleci/[email protected] | ||
|
||
executors: | ||
base: | ||
docker: | ||
- image: cimg/base:stable | ||
node: | ||
docker: | ||
- image: 'cimg/node:16.15.1' | ||
go: | ||
docker: | ||
- image: cimg/go:1.19 | ||
|
||
parameters: | ||
trigger-app: | ||
type: boolean | ||
default: false | ||
trigger-ui: | ||
type: boolean | ||
default: false | ||
run-them-all: | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
## Backend | ||
test_app: | ||
executor: go | ||
working_directory: ~/go/src/github.com/ArtalkJS/Artalk | ||
environment: | ||
GO111MODULE: "on" | ||
steps: | ||
- checkout | ||
- run: | ||
name: "Print the Go version" | ||
command: > | ||
go version | ||
- restore_cache: | ||
keys: | ||
- go-mod-1.19-{{ checksum "go.sum" }} | ||
- run: | ||
name: Install Dependencies | ||
command: go mod download | ||
- save_cache: | ||
key: go-mod-1.19-{{ checksum "go.sum" }} | ||
paths: | ||
- "~/go/pkg/mod" | ||
- run: | ||
name: Run tests | ||
command: | | ||
mkdir -p /tmp/test-reports | ||
gotestsum --junitfile /tmp/test-reports/unit-tests.xml | ||
- store_test_results: | ||
path: /tmp/test-reports | ||
|
||
## Frontend | ||
test_ui: | ||
executor: node | ||
steps: | ||
- node/install | ||
- checkout | ||
- run: | ||
name: Print the node version | ||
command: node -v | ||
- run: | ||
name: Install pnpm | ||
command: npm i -g [email protected] | ||
- run: | ||
name: Install Dependencies | ||
command: pnpm --dir ./ui install --frozen-lockfile | ||
- run: | ||
name: Build Artalk | ||
command: pnpm --dir ./ui build:all | ||
|
||
all_projects: | ||
executor: base | ||
steps: | ||
- run: | ||
command: | | ||
echo "all" | ||
workflows: | ||
build-app: | ||
when: | ||
or: | ||
- << pipeline.parameters.trigger-app >> | ||
- << pipeline.parameters.run-them-all >> | ||
jobs: | ||
- test_app | ||
|
||
build-ui: | ||
when: | ||
or: | ||
- << pipeline.parameters.trigger-ui >> | ||
- << pipeline.parameters.run-them-all >> | ||
jobs: | ||
- test_ui | ||
|
||
build-shared-other: | ||
when: << pipeline.parameters.run-them-all >> | ||
jobs: | ||
- all_projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
# https://circleci.com/docs/2.0/configuration-reference | ||
version: 2.1 | ||
|
||
# this allows you to use CircleCI's dynamic configuration | ||
# https://circleci.com/docs/2.0/dynamic-config/ | ||
setup: true | ||
|
||
# the path-filtering orb is required to continue a pipeline based on | ||
# https://circleci.com/developer/orbs/orb/circleci/path-filtering | ||
orbs: | ||
node: circleci/[email protected] | ||
jobs: | ||
build: | ||
docker: | ||
- image: 'cimg/node:16.15.1' | ||
steps: | ||
- node/install | ||
- checkout | ||
- run: | ||
name: Print the node version | ||
command: node -v | ||
- run: | ||
name: Install pnpm | ||
command: npm i -g [email protected] | ||
- run: | ||
name: Install Dependencies | ||
command: pnpm install --frozen-lockfile | ||
- run: | ||
name: Build Artalk | ||
command: pnpm build:all | ||
path-filtering: circleci/[email protected] | ||
|
||
workflows: | ||
tests: | ||
setup: | ||
jobs: | ||
- build: | ||
- path-filtering/filter: | ||
mapping: | | ||
(cmd|internal|server|pkg|test)/.* trigger-app true | ||
main.go|go.mod|go.sum|artalk.example.yml trigger-app true | ||
(ui)/.* trigger-ui true | ||
base-revision: master # git branch name | ||
config-path: .circleci/conditional_config.yml | ||
filters: | ||
branches: | ||
ignore: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: CI to Docker Hub | ||
|
||
on: | ||
push: | ||
# branches: | ||
# - "master" | ||
tags: | ||
- "v*" | ||
# pull_request: | ||
# branches: | ||
# - "master" | ||
|
||
jobs: | ||
docker: | ||
if: github.repository == 'ArtalkJS/Artalk' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- run: | | ||
git fetch --prune --unshallow --tags -f | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
|
||
# Docker tag 值生成 | ||
# https://github.com/docker/metadata-action | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/artalk | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=sha | ||
# 编译多平台 | ||
# https://github.com/docker/setup-qemu-action | ||
- name: Set up QEMU | ||
id: qemu | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: 'amd64,arm64' # 'all' | ||
|
||
# 缓存 Docker | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
# build docker image | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: ./ | ||
file: ./Dockerfile | ||
platforms: 'linux/amd64,linux/arm64' # ',linux/arm/v7' | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
# 缓存 | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: China Mirror Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
deploy: | ||
if: github.repository == 'ArtalkJS/Artalk' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./docs # set for building docs | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 7.2.1 | ||
|
||
- name: Set node version to 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
registry-url: https://registry.npmjs.org/ | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build | ||
run: pnpm docs:build | ||
|
||
- name: Deploy | ||
uses: TencentCloud/cos-action@v1 | ||
with: | ||
secret_id: ${{ secrets.TENCENT_CLOUD_SECRET_ID }} | ||
secret_key: ${{ secrets.TENCENT_CLOUD_SECRET_KEY }} | ||
cos_bucket: ${{ secrets.DOCS_CN_COS_BUCKET }} | ||
cos_region: ${{ secrets.DOCS_CN_COS_REGION }} | ||
local_path: .vitepress/dist/ | ||
remote_path: / | ||
clean: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,15 +10,21 @@ jobs: | |
publish: | ||
# prevents this action from running on forks | ||
if: github.repository == 'ArtalkJS/Artalk' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./ui # set for building UI | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 7.11.0 | ||
version: 7.25.0 | ||
|
||
- name: Set node version to 16.x | ||
uses: actions/setup-node@v3 | ||
|
@@ -34,7 +40,7 @@ jobs: | |
run: pnpm build | ||
|
||
- name: Publish | ||
run: cd packages/artalk && pnpm publish --no-git-checks | ||
run: pnpm publish -F artalk --no-git-checks | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
|
Oops, something went wrong.