Skip to content

Commit

Permalink
Add Windows to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Dec 1, 2023
1 parent 59739be commit 8c5fe80
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,35 @@ jobs:
name: e-book PDF (Ubuntu)
path: controls-engineering-in-frc-ebook.pdf

windows:
runs-on: windows-latest
defaults:
run:
shell: bash
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install system dependencies
run: ./setup_windows.sh

- name: Generate PDF
run: |
setx path "%PATH%;C:\texlive\2022\bin\win32"
make -j1 ebook
- uses: actions/upload-artifact@v3
with:
name: e-book PDF (Windows)
path: controls-engineering-in-frc-ebook.pdf

macos:
if: false
runs-on: macos-latest
Expand Down
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ rwildcard=$(wildcard $1$2) $(foreach dir,$(wildcard $1*),$(call rwildcard,$(dir)

# C++ files that generate SVG files
CPP := $(filter-out ./bookutil/% ./build/% ./lint/% ./snippets/%,$(call rwildcard,./,*.cpp))
CPP_EXE := $(addprefix build/,$(CPP:.cpp=))
ifeq ($(OS),Windows_NT)
CPP_EXE := $(addprefix build/,$(CPP:.cpp=.exe))
else
CPP_EXE := $(addprefix build/,$(CPP:.cpp=))
endif

# Python files that generate SVG files
PY := $(filter-out ./bookutil/% ./build/% ./lint/% ./setup_venv.py ./snippets/%,$(call rwildcard,./,*.py))
Expand Down Expand Up @@ -90,13 +94,22 @@ build/venv.stamp:
$(VENV_PIP) install frccontrol==2023.28 pylint qrcode requests robotpy-wpimath==2024.0.0b3.post1
@touch $@

ifeq ($(OS),Windows_NT)
$(CPP_EXE): build/%.exe: %.cpp build/venv.stamp
else
$(CPP_EXE): build/%: %.cpp build/venv.stamp
endif
@mkdir -p $(@D)
# Run CMake
cmake -B $(@D) -S $(dir $<)
# Build and run binary
cmake --build $(@D)
cd $(@D) && ./$(notdir $(basename $<))
cmake --build $(@D) --target $(notdir $(basename $@))
ifeq ($(OS),Windows_NT)
cd $(@D)/Debug && ls ./$(notdir $@)
cd $(@D)/Debug && ./$(notdir $@)
else
cd $(@D) && ./$(notdir $@)
endif
# Convert generated CSVs to PDFs
$(abspath $(VENV_PYTHON)) ./snippets/sleipnir_csv_to_pdf.py $(@D)/*.csv

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Install the dependencies via one of the following commands:

* `./setup_archlinux.sh`
* `./setup_ubuntu.sh`
* `./setup_windows.sh'
* `./setup_macos.sh`

Run `make` to generate a PDF named controls-engineering-in-frc-ebook.pdf.
Expand Down
14 changes: 14 additions & 0 deletions setup_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

choco install \
llvm \
imagemagick \
inkscape
choco install texlive --params="'/collections:basic /extraPackages:biber,biblatex,cm-super,csquotes,datatool,enumitem,footmisc,glossaries,glossaries-english,imakeidx,latexmk,mdframed,mfirstuc,needspace,placeins,titlesec,tracklang,type1cm,was,xfor,zref'"
setx path "%PATH%;C:\texlive\2022\bin\win32"

# Python packages
# * black (to format Python source code)
# * gersemi (to format CMake files)
# * pylint (for Python linting)
pip3 install --user autoflake black gersemi qrcode requests wheel

0 comments on commit 8c5fe80

Please sign in to comment.