Skip to content

[WIP] C++ linter and formatter (experimental) #154

[WIP] C++ linter and formatter (experimental)

[WIP] C++ linter and formatter (experimental) #154

Workflow file for this run

name: Stream
on:
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
animation:
name: Animation
runs-on: ubuntu-latest
strategy:
matrix:
port:
- 4048
- 5568
- 6454
toolchain:
- python-version: 3.11
- python-version: 3.14
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.toolchain.python-version }}
cache: pip
cache-dependency-path: tools/pyproject.toml
- name: Set up Frekvens tools
run: pip install tools/
- name: Set up HTTP server
run: |
python - << 'EOF' &
import http.server
class Test(http.server.BaseHTTPRequestHandler):
def do_PATCH(self):
self.send_response(202 if self.path in ["/restful/Modes", "/restful/Stream"] else 404)
self.end_headers()
http.server.HTTPServer(("127.0.0.1", 8080), Test).serve_forever()
EOF
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
- name: Frekvens stream
run: |
cat <<EOL > Animation.csv
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0
0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0
0,0,0,255,255,255,0,0,0,255,0,0,255,0,0,0
0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0
0,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0
0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0
0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0
0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
EOL
sed -i 's/\r\{0,1\}$/\r/' Animation.csv
timeout --preserve-status -s INT 10s python -m frekvens.StreamCsv 127.0.0.1:${{ matrix.port }} -i Animation.csv
drawing:
name: Drawing
runs-on: ubuntu-latest
strategy:
matrix:
port:
- 4048
- 5568
- 6454
toolchain:
- python-version: 3.11
- python-version: 3.14
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.toolchain.python-version }}
cache: pip
cache-dependency-path: tools/pyproject.toml
- name: Set up Frekvens tools
run: pip install tools/
- name: Set up HTTP server
run: |
python - << 'EOF' &
import http.server
class Test(http.server.BaseHTTPRequestHandler):
def do_PATCH(self):
self.send_response(202 if self.path in ["/restful/Modes", "/restful/Stream"] else 404)
self.end_headers()
http.server.HTTPServer(("127.0.0.1", 8080), Test).serve_forever()
EOF
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
- name: Frekvens stream
run: |
cat <<EOL > Drawing.csv
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0
0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0
0,0,0,255,255,255,0,0,0,255,0,0,255,0,0,0
0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0
0,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0
0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0
0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0
0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
EOL
sed -i 's/\r\{0,1\}$/\r/' Drawing.csv
python -m frekvens.StreamCsv 127.0.0.1:${{ matrix.port }} -i Drawing.csv