Skip to content

Commit

Permalink
follow up main repo; fix garmin cn sync issue
Browse files Browse the repository at this point in the history
  • Loading branch information
muyids committed Oct 10, 2023
2 parents 4305348 + fc1ab5d commit 41bfbcc
Show file tree
Hide file tree
Showing 140 changed files with 41,700 additions and 10,616 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// eslint-disable-next-line no-undef
module.exports = {
parser: '@typescript-eslint/parser',
env: {
browser: true,
es2021: true,
Expand All @@ -24,5 +25,9 @@ module.exports = {
rules: {
'prettier/prettier': 'off',
'react/prop-types': 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
globals: {
NodeJS: true,
},
};
21 changes: 7 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,21 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ['3.8', '3.9', '3.10']
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
id: setup_python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# from pdm
- name: Set Variables
id: set_variables
run: |
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
120 changes: 81 additions & 39 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,105 @@ 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@v3

- name: Cache Data Files
if: inputs.save_data_in_github_cache
uses: actions/cache@v3
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/[email protected]
uses: actions/setup-node@v3
with:
node-version: '18'

- 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@v3
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@v1
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: custom.domain.name # optional
# 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@v1
Loading

0 comments on commit 41bfbcc

Please sign in to comment.