From f833cee352f76499746a5d15840fee65b361d306 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 5 Nov 2024 21:33:08 -0800 Subject: [PATCH] pt 2 --- .github/workflows/photon-code-docs.yml | 96 +++++++++++++++++++++++++ .github/workflows/photonvision-docs.yml | 51 +++++++++++++ .github/workflows/python.yml | 68 ++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 .github/workflows/photon-code-docs.yml create mode 100644 .github/workflows/photonvision-docs.yml create mode 100644 .github/workflows/python.yml diff --git a/.github/workflows/photon-code-docs.yml b/.github/workflows/photon-code-docs.yml new file mode 100644 index 0000000000..a8bb9f69fd --- /dev/null +++ b/.github/workflows/photon-code-docs.yml @@ -0,0 +1,96 @@ +name: Photon Code Documentation + +on: + # Run on pushes to master and pushed tags, and on pull requests against master, but ignore the docs folder + push: + branches: [ master ] + tags: + - 'v*' + paths: + - '**' + - '!docs/**' + - '.github/**' + pull_request: + branches: [ master ] + paths: + - '**' + - '!docs/**' + - '.github/**' + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-client: + name: "PhotonClient Build" + defaults: + run: + working-directory: photon-client + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install Dependencies + run: npm ci + - name: Build Production Client + run: npm run build-demo + - uses: actions/upload-artifact@v4 + with: + name: built-client + path: photon-client/dist/ + + run_docs: + runs-on: "ubuntu-22.04" + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags --force + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: Build javadocs/doxygen + run: | + chmod +x gradlew + ./gradlew photon-docs:generateJavaDocs photon-docs:doxygen + + - uses: actions/upload-artifact@v4 + with: + name: built-docs + path: photon-docs/build/docs + + release: + needs: [build-client, run_docs] + + runs-on: ubuntu-22.04 + steps: + + # Download literally every single artifact. + - uses: actions/download-artifact@v4 + + - run: find . + - name: copy file via ssh password + if: github.ref == 'refs/heads/master' + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.WEBMASTER_SSH_HOST }} + username: ${{ secrets.WEBMASTER_SSH_USERNAME }} + password: ${{ secrets.WEBMASTER_SSH_KEY }} + port: ${{ secrets.WEBMASTER_SSH_PORT }} + source: "*" + target: /var/www/html/photonvision-docs/ diff --git a/.github/workflows/photonvision-docs.yml b/.github/workflows/photonvision-docs.yml new file mode 100644 index 0000000000..3b0790cdfa --- /dev/null +++ b/.github/workflows/photonvision-docs.yml @@ -0,0 +1,51 @@ +name: PhotonVision Sphinx Documentation Checks + +on: + push: + branches: [ master ] + paths: + - 'docs/**' + - '.github/**' + pull_request: + branches: [ master ] + paths: + - 'docs/**' + - '.github/**' + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install and upgrade pip + run: python -m pip install --upgrade pip + + - name: Install graphviz + run: | + sudo apt-get update + sudo apt-get -y install graphviz + + - name: Install Python dependencies + working-directory: docs + run: | + pip install sphinx sphinx_rtd_theme sphinx-tabs sphinxext-opengraph doc8 + pip install -r requirements.txt + + - name: Check links + working-directory: docs + run: make linkcheck + continue-on-error: true + + - name: Check lint + working-directory: docs + run: make lint + + - name: Compile HTML + working-directory: docs + run: make html diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000000..cfe5af2c34 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,68 @@ +name: Build and Distribute PhotonLibPy + +permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + +on: + push: + branches: [ master ] + tags: + - 'v*' + paths: + - '**' + - '!docs/**' + - '.github/**' + pull_request: + branches: [ master ] + paths: + - '**' + - '!docs/**' + - '.github/**' + +jobs: + buildAndDeploy: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel pytest + + - name: Build wheel + working-directory: ./photon-lib/py + run: | + python setup.py sdist bdist_wheel + + - name: Run Unit Tests + working-directory: ./photon-lib/py + run: | + pip install --no-cache-dir dist/*.whl + pytest + + + - name: Upload artifacts + uses: actions/upload-artifact@master + with: + name: dist + path: ./photon-lib/py/dist/ + + - name: Publish package distributions to TestPyPI + # Only upload on tags + if: startsWith(github.ref, 'refs/tags/v') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages_dir: ./photon-lib/py/dist/ + + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing