Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
zongbintu committed Feb 6, 2024
2 parents 26be116 + c30a060 commit adf7f00
Show file tree
Hide file tree
Showing 107 changed files with 7,150 additions and 12,774 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// eslint-disable-next-line no-undef
module.exports = {
parser: '@typescript-eslint/parser',
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:prettier/recommended',
],
overrides: [],
Expand All @@ -24,5 +26,9 @@ module.exports = {
rules: {
'prettier/prettier': 'off',
'react/prop-types': 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
globals: {
NodeJS: true,
},
};
23 changes: 8 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,19 @@ jobs:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
id: setup_python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# from pdm
- name: Set Variables and install dep
id: set_variables
run: |
sudo apt-get install libxml2-dev libxslt-dev python3-dev
echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_OUTPUT
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache PIP
uses: actions/cache@v2
with:
path: ${{ steps.set_variables.outputs.PIP_CACHE }}
key: ${{ runner.os }}-pip-${{ steps.set_variables.outputs.PY }}
cache: 'pip'
cache-dependency-path: 'requirements-dev.txt'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Check formatting (black)
run: black . --check
123 changes: 84 additions & 39 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,108 @@ name: Publish GitHub Pages

# Controls when the action will run.
on:
# trigger when the Run Data Sync workflow succeeded
workflow_run:
workflows: ["Run Data Sync"]
types:
- completed

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
save_data_in_github_cache:
required: true
type: boolean
default: false
data_cache_prefix:
required: true
type: string
default: track_data
workflow_call:
inputs:
save_data_in_github_cache:
required: true
type: boolean
default: false
data_cache_prefix:
required: true
type: string
default: track_data

permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
build_and_deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
# if your default branches is not master, please change it here
ref: master

- name: Cache Data Files
if: inputs.save_data_in_github_cache
uses: actions/cache@v4
with:
path: |
activities
assets
GPX_OUT
TCX_OUT
FIT_OUT
Workouts
run_page/data.db
src/static/activities.json
imported.json
key: ${{ inputs.data_cache_prefix }}-${{ github.sha }}-${{ github.run_id }}
restore-keys: |
${{ inputs.data_cache_prefix }}-${{ github.sha }}-
${{ inputs.data_cache_prefix }}-
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.4
uses: actions/setup-node@v4
with:
node-version: '20'

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
node-version: "16"
version: 8
run_install: false

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- run: |
yarn install
- run: |
PATH_PREFIX=/${{ github.event.repository.name }} yarn build --prefix-paths
- run: |
cp -r assets/ public/static
- name: Install dependencies
run: pnpm install
- name: Build
run: PATH_PREFIX=/${{ github.event.repository.name }} pnpm build

- name: GitHub Pages
uses: crazy-max/ghaction-github-pages@v2.2.0
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Git branch where site will be deployed
target_branch: gh-pages
# Create incremental commit instead of doing push force
keep_history: true
# Build directory to deploy
build_dir: public
# Write the given domain name to the CNAME file
fqdn: workout.520wa.com
# Prevent Jekyll from building the site
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
Loading

0 comments on commit adf7f00

Please sign in to comment.