Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feat: refactor channel to broadcast to desktop #44

Open
wants to merge 2 commits into
base: feat/for_desktop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 118 additions & 95 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,74 @@
# Each PR will build preview site that help to check code is work as expect.

name: Build

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
# - develop
- feat/for_desktop
- feat/for_desktop*
tags:
- '*'

defaults:
run:
shell: bash -leo pipefail {0}

jobs:
# Prepare node modules. Reuse cache if available
setup:
name: prepare build
runs-on: ubuntu-latest
runs-on: [self-hosted, X64, Linux, builder]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: checkout
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16.14'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- uses: actions/cache@v3
id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

- name: Get Yarn Cache
if: steps.yarn-cache.outputs.cache-hit == 'true'
run: yarn --prefer-offline
- name: Env Test
id: env-test
run: |
echo "whoami $(whoami)"
echo "shell is $(echo $0)"
echo "which node $(which node)"
# - name: Setup node
# uses: actions/setup-node@v3
# with:
# node-version: '16.14'
# cache: 'yarn'

# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"

# - uses: actions/cache@v3
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

# - uses: actions/cache@v3
# id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: node_modules
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

# - name: Get Yarn Cache
# if: steps.yarn-cache.outputs.cache-hit == 'true'
# run: yarn --prefer-offline

- name: Use NPM Token with organization read access
uses: heisenberg-2077/use-npm-token-action@v1
with:
token: '${{ secrets.NPM_AUTH_TOKEN }}'

- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
# - name: Install Dependencies
# if: steps.yarn-cache.outputs.cache-hit != 'true'
# run: yarn install --frozen-lockfile

build-pro:
name: build pro
runs-on: ubuntu-latest
runs-on: [self-hosted, X64, Linux, builder]
needs: setup
env:
NODE_OPTIONS: '--max_old_space_size=4096'
Expand All @@ -81,65 +93,76 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

- name: build
run: yarn build:pro

- name: Upload artifact
uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: Rabby_${{github.sha}}
path: dist
retention-days: 7

- name: Upload artifact
uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'push' }}
with:
name: Rabby_${{github.ref_name}}
path: dist
retention-days: 7

build-debug:
name: build debug
runs-on: ubuntu-latest
needs: setup
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: checkout
uses: actions/checkout@v3

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- uses: actions/cache@v3
id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

- name: build
run: yarn build:debug

- name: Upload artifact
uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: Rabby_${{github.sha}}_debug
path: dist
retention-days: 7

- name: Upload artifact
uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'push' }}
with:
name: Rabby_${{github.ref_name}}_debug
path: dist
retention-days: 7
run: |
sh ./scripts/pack.sh;
env:
RABBY_BUILD_BUCKET: ${{ secrets.RABBY_BUILD_BUCKET }}
LARK_CHAT_URL: ${{ secrets.LARK_CHAT_URL }}
LARK_CHAT_SECRET: ${{ secrets.LARK_CHAT_SECRET }}
# see more details on https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
ACTIONS_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GIT_COMMIT_URL: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}
GIT_REF_NAME: ${{ github.ref_name }}
GIT_REF_URL: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }}
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# if: ${{ github.event_name == 'pull_request' }}
# with:
# name: Rabby_${{github.sha}}
# path: dist
# retention-days: 7

# - name: Upload artifact
# uses: actions/upload-artifact@v3
# if: ${{ github.event_name == 'push' }}
# with:
# name: Rabby_${{github.ref_name}}
# path: dist
# retention-days: 7

# build-debug:
# name: build debug
# runs-on: [self-hosted, X64, Linux, builder]
# needs: setup
# env:
# NODE_OPTIONS: '--max_old_space_size=4096'
# steps:
# - name: checkout
# uses: actions/checkout@v3

# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"

# - uses: actions/cache@v3
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

# - uses: actions/cache@v3
# id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: node_modules
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

# - name: build
# run: yarn build:debug

# - name: Upload artifact
# uses: actions/upload-artifact@v3
# if: ${{ github.event_name == 'pull_request' }}
# with:
# name: Rabby_${{github.sha}}_debug
# path: dist
# retention-days: 7

# - name: Upload artifact
# uses: actions/upload-artifact@v3
# if: ${{ github.event_name == 'push' }}
# with:
# name: Rabby_${{github.ref_name}}_debug
# path: dist
# retention-days: 7
95 changes: 95 additions & 0 deletions .github/workflows/build_debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Each PR will build debug that help to check if build works as expect.

name: Test Build

on:
pull_request:
types: [opened, synchronize, reopened]

defaults:
run:
shell: bash -leo pipefail {0}

jobs:
# Prepare node modules. Reuse cache if available
setup:
name: prepare build
runs-on: [self-hosted, X64, Linux, builder]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: checkout
uses: actions/checkout@v3

- name: Env Test
id: env-test
run: |
echo "whoami $(whoami)"
echo "shell is $(echo $0)"
echo "which node $(which node)"
# - name: Setup node
# uses: actions/setup-node@v3
# with:
# node-version: '16.14'
# cache: 'yarn'

# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"

# - uses: actions/cache@v3
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

# - uses: actions/cache@v3
# id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: node_modules
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

# - name: Get Yarn Cache
# if: steps.yarn-cache.outputs.cache-hit == 'true'
# run: yarn --prefer-offline

- name: Use NPM Token with organization read access
uses: heisenberg-2077/use-npm-token-action@v1
with:
token: '${{ secrets.NPM_AUTH_TOKEN }}'

# - name: Install Dependencies
# if: steps.yarn-cache.outputs.cache-hit != 'true'
# run: yarn install --frozen-lockfile

build-debug:
name: build debug
runs-on: [self-hosted, X64, Linux, builder]
needs: setup
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: checkout
uses: actions/checkout@v3

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- uses: actions/cache@v3
id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

- name: build
run: |
export NO_UPLOAD=1;
sh ./scripts/pack.sh;
13 changes: 8 additions & 5 deletions .github/workflows/private.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Triger Private Build

on:
pull_request:
types: [opened, synchronize, reopened]
# pull_request:
# types: [opened, synchronize, reopened]
push:
branches:
- develop
tags:
- v*
- dont_trigger
# - develop
# - feat/for_desktop
# - feat/for_desktop*
# tags:
# - v*

jobs:
create-new-private-build:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ dist
dist-*
.yarn
.DS_Store
yarn-error
yarn-error

tmp
2 changes: 1 addition & 1 deletion _raw/vendor/matomo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _paq.push(['enableLinkTracking']);
chrome.storage.local.get('extensionId', function (result) {
var u = 'https://matomo.debank.com/';
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', '2']);
_paq.push(['setSiteId', '4']);
if (result.extensionId) {
_paq.push(['setVisitorId', result.extensionId]);
}
Expand Down
Loading