Skip to content

Commit 22c7820

Browse files
committed
Implement GitHub CI
Add GitHub action files which will compile the emulator on every commit (should do a basic checkout) and generate a new release on any new pushed tag.
1 parent 2ebc9e8 commit 22c7820

12 files changed

Lines changed: 207 additions & 7 deletions

File tree

.github/workflows/build-arm.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: vortex-build-arm64
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
workflow_call:
9+
outputs:
10+
artifact-url:
11+
description: "Artifact URL"
12+
value: ${{ jobs.build.outputs.output1 }}
13+
artifact-id:
14+
description: "Artifact ID"
15+
value: ${{ jobs.build.outputs.output2 }}
16+
artifact-digest:
17+
description: "Artifact Digest SHA"
18+
value: ${{ jobs.build.outputs.output3 }}
19+
vortex-version:
20+
description: "Version of the artifact"
21+
value: ${{ jobs.build.outputs.output4 }}
22+
build-arch:
23+
description: "Build architecture"
24+
value: ${{ jobs.build.outputs.output5 }}
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-24.04-arm
32+
outputs:
33+
output1: ${{ steps.upload-artifact.outputs.artifact-url }}
34+
output2: ${{ steps.upload-artifact.outputs.artifact-id }}
35+
output3: ${{ steps.upload-artifact.outputs.artifact-digest }}
36+
output4: ${{ steps.vortex-version.outputs.vortex-version }}
37+
output5: ${{ steps.vortex-arch.outputs.vortex-arch }}
38+
steps:
39+
- uses: actions/checkout@v5
40+
with:
41+
fetch-depth: 0
42+
fetch-tags: true
43+
- name: Set up Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.13'
47+
- name: Get Version
48+
id: vortex-version
49+
run: echo "vortex-version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
50+
- name: Get Arch
51+
id: vortex-arch
52+
run: echo "vortex-arch=$(uname -m)" >> $GITHUB_OUTPUT
53+
- name: Install dependencies
54+
run: |
55+
sudo apt update
56+
sudo apt install -y meson libgirepository-2.0-dev libcairo2-dev
57+
python -m pip install --upgrade pip setuptools wheel flake8 meson
58+
pip install -r virtualenv.txt
59+
# - name: Lint with flake8
60+
# run: |
61+
# # stop the build if there are Python syntax errors or undefined names
62+
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
63+
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
64+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
65+
- name: Build emulator ${{ steps.vortex-version.outputs.vortex-version }}
66+
run: make package
67+
- name: Upload asset
68+
id: upload-artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: vortex-${{ steps.vortex-version.outputs.vortex-version }}-${{ steps.vortex-arch.outputs.vortex-arch }}
72+
path: vortex-${{ steps.vortex-version.outputs.vortex-version }}-${{ steps.vortex-arch.outputs.vortex-arch }}.tar.bz2

.github/workflows/build-x64.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: vortex-build-x64
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
workflow_call:
9+
outputs:
10+
artifact-url:
11+
description: "Artifact URL"
12+
value: ${{ jobs.build.outputs.output1 }}
13+
artifact-id:
14+
description: "Artifact ID"
15+
value: ${{ jobs.build.outputs.output2 }}
16+
artifact-digest:
17+
description: "Artifact Digest SHA"
18+
value: ${{ jobs.build.outputs.output3 }}
19+
vortex-version:
20+
description: "Version of the artifact"
21+
value: ${{ jobs.build.outputs.output4 }}
22+
build-arch:
23+
description: "Build architecture"
24+
value: ${{ jobs.build.outputs.output5 }}
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
output1: ${{ steps.upload-artifact.outputs.artifact-url }}
34+
output2: ${{ steps.upload-artifact.outputs.artifact-id }}
35+
output3: ${{ steps.upload-artifact.outputs.artifact-digest }}
36+
output4: ${{ steps.vortex-version.outputs.vortex-version }}
37+
output5: ${{ steps.vortex-arch.outputs.vortex-arch }}
38+
steps:
39+
- uses: actions/checkout@v5
40+
with:
41+
fetch-depth: 0
42+
fetch-tags: true
43+
- name: Set up Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.13'
47+
- name: Get Version
48+
id: vortex-version
49+
run: echo "vortex-version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
50+
- name: Get Arch
51+
id: vortex-arch
52+
run: echo "vortex-arch=$(uname -m)" >> $GITHUB_OUTPUT
53+
- name: Install dependencies
54+
run: |
55+
sudo apt update
56+
sudo apt install -y meson libgirepository-2.0-dev libcairo2-dev
57+
python -m pip install --upgrade pip setuptools wheel flake8 meson
58+
pip install -r virtualenv.txt
59+
# - name: Lint with flake8
60+
# run: |
61+
# # stop the build if there are Python syntax errors or undefined names
62+
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
63+
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
64+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
65+
- name: Build emulator ${{ steps.vortex-version.outputs.vortex-version }}
66+
run: make package
67+
- name: Upload asset
68+
id: upload-artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: vortex-${{ steps.vortex-version.outputs.vortex-version }}-${{ steps.vortex-arch.outputs.vortex-arch }}
72+
path: vortex-${{ steps.vortex-version.outputs.vortex-version }}-${{ steps.vortex-arch.outputs.vortex-arch }}.tar.bz2

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: vortex-release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-dep-x64:
13+
uses: ./.github/workflows/build-x64.yml
14+
15+
build-dep-arm:
16+
uses: ./.github/workflows/build-arm.yml
17+
18+
publish-release:
19+
runs-on: ubuntu-latest
20+
needs: [build-dep-x64, build-dep-arm]
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v5
24+
with:
25+
fetch-depth: 0
26+
fetch-tags: true
27+
- name: Download Artifacts
28+
uses: actions/download-artifact@v5
29+
with:
30+
artifact-ids: ${{ needs.build-dep-arm.outputs.artifact-id}}, ${{ needs.build-dep-x64.outputs.artifact-id }}
31+
merge-multiple: true
32+
- name: Create GitHub Release
33+
id: create-release
34+
uses: softprops/action-gh-release@v2
35+
with:
36+
tag_name: ${{ github.ref_name }}
37+
name: Release ${{ github.ref_name }}
38+
draft: false
39+
prerelease: false
40+
repository: voidtrance/vortex
41+
files: |
42+
vortex-${{ needs.build-dep-x64.outputs.vortex-version }}-${{ needs.build-dep-x64.outputs.build-arch }}.tar.bz2
43+
vortex-${{ needs.build-dep-arm.outputs.vortex-version }}-${{ needs.build-dep-arm.outputs.build-arch }}.tar.bz2
44+

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ MESON_DEBUG_OPTS :=
2727
GCC_BUILD_OPTS :=
2828
VERSION=$(shell git describe --tags --abbrev=0)
2929
KVER := $(shell uname -r)
30+
ARCH := $(shell uname -m)
3031

3132
PYTHON_VERSION=$(shell $(PYTHON) -c "import platform; print(platform.python_version())")
3233
PYTHON_VERSION_NUMS = $(subst ., ,$(PYTHON_VERSION))
@@ -75,6 +76,15 @@ venv:
7576
wheel: venv version
7677
$(VENV_PYTHON) -m build -w .
7778

79+
package: version
80+
$(PYTHON) -m build -w .
81+
mkdir -p vortex-$(VERSION)-$(ARCH)
82+
mkdir vortex-$(VERSION)-$(ARCH)/vortex-kmod
83+
cp src/kmod/vortex.[ch] src/kmod/Makefile vortex-$(VERSION)-$(ARCH)/vortex-kmod
84+
cp dist/vortex-*.whl vortex-$(VERSION)-$(ARCH)
85+
tar -jcf vortex-$(VERSION)-$(ARCH).tar.bz2 vortex-$(VERSION)-$(ARCH)
86+
rm -rf vortex-$(VERSION)-$(ARCH)
87+
7888
install: wheel
7989
$(VENV_PYTHON) -m pip install --force-reinstall dist/vortex-*.whl
8090

@@ -84,4 +94,4 @@ gdb:
8494
clean:
8595
$(MAKE) -C /lib/modules/$(KVER)/build M=$${PWD}/src/kmod clean
8696
rm -rf build dist builddir
87-
rm -f compile_commands.json version.txt
97+
rm -f compile_commands.json version.txt vortex-*.tar.bz2

frontends/gcode/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def G28(self, cmd):
147147
for x in axes_ids}
148148
endstop_status = self.query_object(axis_endstop_ids.values())
149149
for axis in axes_ids:
150-
self.log.debug(f"Homing axis {AxisType(status[axis]["type"])}")
150+
self.log.debug(f"Homing axis {AxisType(status[axis]['type'])}")
151151
motor_ids = {}
152152
for motor in [x for x in status[axis]["motors"] if x]:
153153
motor_ids[motor] = self.get_object_id(ObjectKlass.STEPPER, motor)

frontends/lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import fcntl
1919
import termios
2020

21-
__all__ = ["create_pty", "div_round_up"]
21+
__all__ = ["create_pty"]
2222

2323
def create_pty(filename):
2424
master, slave = pty.openpty()

src/core/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ static PyObject *vortex_core_exec_command(PyObject *self, PyObject *args,
936936
void *cmd_args = NULL;
937937
core_object_t *object;
938938
core_object_command_t *cmd;
939-
PyObject *rc;
939+
PyObject *rc = NULL;
940940
int ret = -1;
941941

942942
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "kkHk:exec_command", kw, &cmd_id, &object,

src/core/objects/stepper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static int stepper_use_pins(core_object_t *object, uint64_t id, void *args) {
253253
stepper_t *stepper = (stepper_t *)object;
254254
struct stepper_use_pins_args *opts = (struct stepper_use_pins_args *)args;
255255
struct stepper_use_pins_data *data = NULL;
256-
int ret;
256+
int ret = 0;
257257

258258
if (opts->enable) {
259259
if (!stepper->use_pins) {

src/lib/logging/logging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifndef __LOGGING_H__
1919
#define __LOGGING_H__
2020
#include <stddef.h>
21+
#include <stdbool.h>
2122

2223
typedef enum {
2324
LOG_LEVEL_NOTSET,

test/framework.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def logging_enabled(self):
126126
return self._logfile is not None
127127

128128
def begin(self, test_name, klass=None):
129-
print(f"Running {"object " if klass else ""}test '{test_name}'...", flush=True)
129+
print(f"Running {'object ' if klass else ''}test '{test_name}'...", flush=True)
130130
self._write_logfile("=" * 30 + "\n")
131131
self._write_logfile(f"Running test '{test_name}\n")
132132

0 commit comments

Comments
 (0)