Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
agassiyzh committed May 16, 2024
2 parents 41eff0a + 182fc0b commit 66c45bd
Show file tree
Hide file tree
Showing 62 changed files with 5,729 additions and 696 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4

Expand Down
63 changes: 27 additions & 36 deletions .github/workflows/run_data_sync.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,23 @@
name: Run Data Sync

on:
workflow_call:
inputs:
run_type:
required: true
type: string
get_all_garmin_data:
description: 'if get all garmin data'
required: false
default: false
type: boolean
workflow_dispatch:
inputs:
get_all_garmin_data:
description: 'if get all garmin data'
required: false
default: false
type: boolean
run_type:
description: 'run type'
required: true
default: 'pass'
type: choice
options:
- strava
- nike
- garmin
- garmin_cn
- keep
- only_gpx
- only_tcx
- only_fit
- nike_to_strava
- strava_to_garmin
- strava_to_garmin_cn
- garmin_to_strava
- garmin_to_strava_cn
- codoon
schedule:
- cron: '0 0 * * *'
push:
branches:
- master
paths:
- run_page/nike_sync.py
- run_page/nike_to_strava_sync.py
- run_page/strava_sync.py
- run_page/gen_svg.py
- run_page/garmin_sync.py
- run_page/keep_sync.py
- run_page/gpx_sync.py
- run_page/tcx_sync.py
- run_page/garmin_to_strava_sync.py
- requirements.txt

env:
# please change to your own config.
Expand Down Expand Up @@ -116,6 +96,17 @@ jobs:
run: |
python run_page/keep_sync.py ${{ secrets.KEEP_MOBILE }} ${{ secrets.KEEP_PASSWORD }} --with-gpx
- name: Run sync Coros script
if: env.RUN_TYPE == 'coros'
run: |
python run_page/coros_sync.py ${{ secrets.COROS_ACCOUNT }} ${{ secrets.COROS_PASSWORD }}
- name: Run sync Keep_to_strava script
if: env.RUN_TYPE == 'keep_to_strava_sync'
run: |
python run_page/keep_to_strava_sync.py ${{ secrets.KEEP_MOBILE }} ${{ secrets.KEEP_PASSWORD }} ${{ secrets.STRAVA_CLIENT_ID }} ${{ secrets.STRAVA_CLIENT_SECRET }} ${{ secrets.STRAVA_CLIENT_REFRESH_TOKEN }} --sync-types running cycling hiking
# If you only want to sync `type running` modify args --sync-types running, default script is to sync all data (rides, hikes and runs).

- name: Run sync Strava script
if: inputs.run_type == 'strava'
run: |
Expand Down
1 change: 1 addition & 0 deletions .prettierrc.js → .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
semi: true,
bracketSpacing: true,
singleQuote: true,
plugins: ['prettier-plugin-tailwindcss']
};
1 change: 1 addition & 0 deletions .vercelignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requirements.txt
requirements-dev.txt
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
FROM python:3.10.5-slim AS develop-py
WORKDIR /root/running_page
COPY ./requirements.txt /root/running_page/requirements.txt
# Add proxy for apt.
# ENV http_proxy http://ip_address:port
# ENV https_proxy http://ip_address:port
RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& apt-get purge -y --auto-remove \
Expand All @@ -14,12 +17,10 @@ FROM node:18 AS develop-node
WORKDIR /root/running_page
COPY ./package.json /root/running_page/package.json
COPY ./pnpm-lock.yaml /root/running_page/pnpm-lock.yaml
RUN npm config set registry https://registry.npm.taobao.org \
RUN npm config rm proxy&&npm config set registry https://registry.npmjs.org/ \
&&npm install -g corepack \
&&corepack enable \
&&pnpm install


&&yarn install

FROM develop-py AS data
ARG app
Expand All @@ -29,6 +30,8 @@ ARG client_id
ARG client_secret
ARG refresh_token
ARG YOUR_NAME
ARG keep_phone_number
ARG keep_password

WORKDIR /root/running_page
COPY . /root/running_page/
Expand All @@ -45,6 +48,8 @@ RUN DUMMY=${DUMMY}; \
python3 run_page/strava_sync.py ${client_id} ${client_secret} ${refresh_token};\
elif [ "$app" = "Nike_to_Strava" ] ; then \
python3 run_page/nike_to_strava_sync.py ${nike_refresh_token} ${client_id} ${client_secret} ${refresh_token};\
elif [ "$app" = "Keep" ] ; then \
python3 run_page/keep_sync.py ${keep_phone_number} ${keep_password};\
else \
echo "Unknown app" ; \
fi
Expand All @@ -56,7 +61,7 @@ RUN python3 run_page/gen_svg.py --from-db --title "my running page" --type grid
FROM develop-node AS frontend-build
WORKDIR /root/running_page
COPY --from=data /root/running_page /root/running_page
RUN pnpm run build
RUN yarn run build

FROM nginx:alpine AS web
COPY --from=frontend-build /root/running_page/dist /usr/share/nginx/html/
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/images/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Running Page</title>
<title>Workouts Page</title>
</head>
<body>
<div id="root"></div>
Expand Down
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"@mapbox/mapbox-gl-language": "^1.0.0",
"@mapbox/polyline": "^1.1.1",
"@surbowl/world-geo-json-zh": "^2.1.3",
"@svgr/plugin-svgo": "^8.1.0",
"@vercel/analytics": "^0.1.6",
"@vitejs/plugin-react": "^4.0.0",
Expand All @@ -19,17 +20,14 @@
"react-helmet-async": "^1.3.0",
"react-map-gl": "^7.1.6",
"react-router-dom": "^6.15.0",
"sass": "^1.52.3",
"sass-mq": "^6.0.0",
"tachyons": "^4.12.0",
"tachyons-sass": "git+https://github.com/tachyons-css/tachyons-sass.git",
"viewport-mercator-project": "^7.0.4",
"vite": "^4.3.9",
"vite-plugin-svgr": "^3.2.0",
"vite-tsconfig-paths": "^4.2.0"
},
"license": "MIT",
"private": true,
"type": "module",
"scripts": {
"data:clean": "rm run_page/data.db {GPX,TCX,FIT}_OUT/* activities/* src/static/activities.json",
"data:download:garmin": "python3 run_page/garmin_sync.py",
Expand All @@ -38,7 +36,7 @@
"develop": "vite dev",
"serve": "vite serve",
"lint": "eslint --ext .ts,.tsx src --fix",
"check": "prettier --write src/main.tsx src/**/*.{scss,json,ts,tsx} *.{md,yaml,json,ts,js}",
"check": "prettier --write src/main.tsx src/**/*.{css,json,ts,tsx} *.{md,yaml,json,ts,js}",
"ci": "pnpm run check && pnpm run lint && pnpm run build"
},
"engineStrict": true,
Expand All @@ -51,17 +49,22 @@
"url": "https://github.com/ben-29/workouts_page"
},
"devDependencies": {
"@types/geojson": "^7946.0.14",
"@types/mapbox__polyline": "^1.0.2",
"@types/node": "^20.3.3",
"@types/prop-types": "^15.7.11",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@typescript-eslint/parser": "^5.59.2",
"autoprefixer": "^10.4.19",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"prettier": "2.8.8",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.13",
"tailwindcss": "^3.4.3",
"typescript": "^5.1.6"
},
"packageManager": "pnpm@8.7.0"
}
}
Loading

0 comments on commit 66c45bd

Please sign in to comment.