Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
merging from main
Browse files Browse the repository at this point in the history
  • Loading branch information
kredcool committed Feb 22, 2024
2 parents e88f2a8 + 2e6cbfa commit a133fb1
Show file tree
Hide file tree
Showing 40 changed files with 4,825 additions and 115 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/dashboard-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Makefile CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
make_dashboard:
name: Build Dashboard
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
architecture: x64

- run: sudo apt update

- run: sudo apt install curl

- name: Install NPM
run: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

- name: Install npm deps
run: cd dashboard && npm ci

- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('dashboard/Pipfile.lock') }}

- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
cd dashboard && pipenv install --deploy --dev
- run: cd dashboard && pipenv run make stage

- uses: actions/upload-artifact@v2
with:
name: Dashboard_Transpiled
path: dashboard/dist

publish:
# Only run on tags
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
name: Publish
needs: [make_dashboard]

steps:
- uses: actions/download-artifact@v2
with:
name: Dashboard_Transpiled
path: Dashboard_Transpiled/

- uses: papeloto/action-zip@v1
with:
files: Dashboard_Transpiled/
dest: Dashboard_Transpiled.zip

- name: Upload Dashboard to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*.zip"
tag: ${{ github.ref }}
overwrite: true
prerelease: true
body: "Tidal Force Robotics, Automated with github ci/cd."
file_glob: true
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,13 @@ networktables.json
# Add to tree but only when neccicary (adding a map or smthn)
simgui-window.json

# ===========
# Dashboard
# ===========

.parcel-cache/
node_modules/
dashboard.zip

# sysid ignores
*.SysId
32 changes: 32 additions & 0 deletions dashboard/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# FRC 1721 Tidal Force
# 2023-2024
#

ROOT := $(PWD)
STAGEDIR := $(ROOT)/dist/
DASH_HASH := $(shell git describe --tags --always)

all: help
help: # List all commands and their descriptions
@echo
@cat Makefile | grep ': #' --color=never | sed '/^\t/d' | sed 's/: / /' | column -t -s '#'
@echo

ready: # Run the necessary commands for development
pipenv install
npm ci
build: # Run `parcel build' and inject NetworkTables
npm run build
./build.sh
run: # Run a live server of the dashboard
cd dist && pipenv run python -m pynetworktables2js
dev: # Automatically run `make build' whenever a file changes in src/ (requires program `entr')
find src/ | entr sh -c 'make build'
clean: # Run `git clean -fdX
git clean -fdX
stage: # Prepares dist/ for deployment
rm -rf dist/
make build
cp entrypoint.sh $(STAGEDIR)
cp run.bat $(STAGEDIR)
12 changes: 12 additions & 0 deletions dashboard/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pynetworktables2js = {ref = "refs/pull/45/head", git = "git+https://github.com/robotpy/pynetworktables2js.git"}

[dev-packages]

[requires]
python_version = "3.11"
93 changes: 93 additions & 0 deletions dashboard/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# FRC 1721 Dashboard
## Getting Started
- Make sure you have sed installed
- Make sure Robot sim is running
- Make sure npm is installed

Make sure you are in the dashboard/ folder.

Install deps

``` sh
npm ci
```

Build webpage

``` sh
make build
```

(NOT REQUIRED) You can build automatically when a file changes in src/ (requires 'entr', `paru -S entr` `paman install entr`)

``` sh
make dev
```

Run webpage

``` sh
make run
```

`make run` can be left running when you run `make build`, and doesn't need to be run again to update the webpage
12 changes: 12 additions & 0 deletions dashboard/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sed -i -e 's/<p><\/p>/<script src="\/networktables\/networktables.js"><\/script><p><\/p>/g' dist/index.html
sed -i -e 's/<p><\/p>/<script src="\/networktables\/utils.js"><\/script><p><\/p>/g' dist/index.html
sed -i -e 's/<p><\/p>/<script src="\/networktables\/camera.js"><\/script>/g' dist/index.html

sed -i -e "/<\!--FL-->/rsrc/asset/wheel/FL.svg" dist/index.html
sed -i -e "/<\!--FR-->/rsrc/asset/wheel/FR.svg" dist/index.html
sed -i -e "/<\!--RL-->/rsrc/asset/wheel/RL.svg" dist/index.html
sed -i -e "/<\!--RR-->/rsrc/asset/wheel/RR.svg" dist/index.html
sed -i -e "/<\!--FLd-->/rsrc/asset/wheel/FLd.svg" dist/index.html
sed -i -e "/<\!--FRd-->/rsrc/asset/wheel/FRd.svg" dist/index.html
sed -i -e "/<\!--RLd-->/rsrc/asset/wheel/RLd.svg" dist/index.html
sed -i -e "/<\!--RRd-->/rsrc/asset/wheel/RRd.svg" dist/index.html
4 changes: 4 additions & 0 deletions dashboard/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh


python -m pynetworktables2js --port=5800 --robot=10.17.21.2
Loading

0 comments on commit a133fb1

Please sign in to comment.