Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version #31

Merged
merged 9 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 178 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
name: release
# Based on https://github.com/ra3xdh/qucs_s/.github/workflows/deploy.yml

on:
push:
tags:
- '*'

env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

jobs:
build-debian-packages:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
os_name: ['bullseye', 'bookworm', 'trixie']
container:
# https://hub.docker.com/_/debian
image: debian:${{matrix.os_name}}
steps:
- uses: actions/checkout@v4

- name: 'Install Dependencies'
shell: bash
run: |
apt-get update
# https://serverfault.com/a/992421
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential qtbase5-dev qttools5-dev-tools libqt5serialport5-dev

- name: 'Build'
shell: bash
run: install/deb-build.sh -s debian-${{matrix.os_name}} -v ${{ github.ref_name }}

- name: 'Upload debian packages'
uses: actions/upload-artifact@v4
with:
name: debian-${{matrix.os_name}}
path: '*.deb'

build-ubuntu-packages:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
os_name: ['focal', 'jammy', 'mantic', 'noble']
container:
# https://hub.docker.com/_/ubuntu
image: ubuntu:${{matrix.os_name}}
steps:
- uses: actions/checkout@v4

- name: 'Install Dependencies'
shell: bash
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential qtbase5-dev qttools5-dev-tools libqt5serialport5-dev

- name: 'Build'
shell: bash
run: install/deb-build.sh -s ubuntu-${{matrix.os_name}} -v ${{ github.ref_name }}

- name: 'Upload ubuntu packages'
uses: actions/upload-artifact@v4
with:
name: ubuntu-${{matrix.os_name}}
path: '*.deb'

build-windows-installer:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
msystem: ['mingw64', 'mingw32']
defaults:
run:
shell: msys2 {0}
steps:
- name: Disable autocrlf in Git
shell: pwsh
# https://github.com/msys2/setup-msys2?tab=readme-ov-file#actionscheckout-and-line-endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up MSYS2 environment
# The qt5-serialport package is now missing from mingw32, so we use
# a static build. The openssl package is needed for qt-static, but it is
# not in the qt5-static dependencies and so has to be installed explicitly.
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.msystem}}
cache: true
update: true
install: >-
make
zip
pacboy: >-
gcc:p
nsis:p
qt5-static:p
openssl:p

- name: 'Build'
run: install/win-msys2-build.sh -s windows -v ${{ github.ref_name }} -q /${{matrix.msystem}}/qt5-static/bin/qmake.exe

- name: 'Upload windows installers'
uses: actions/upload-artifact@v4
with:
name: windows-${{matrix.msystem}}
path: |
*.exe
*.zip

create-release:
runs-on: ubuntu-latest
needs: [build-debian-packages, build-ubuntu-packages, build-windows-installer]
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: ~/artifacts
merge-multiple: true

- name: Calculate SHA-256 checksums
run: |
cd ~/artifacts
echo 'SHA-256 checksums' > notes.txt
echo '-----------------' >> notes.txt
echo -e '\n```' >> notes.txt
for file in $(find . -type f \( -name "*.exe" -o -name "*.zip" -o -name "*.deb" -o -name "*.rpm" \) | sort); do
filename=$(basename "$file")
checksum=$(sha256sum "$file" | awk '{print $1}')
echo "$checksum $filename" >> notes.txt
#echo $checksum > "$filename".sha256
done
echo -e '```\n' >> notes.txt
cd ..
tree ~/artifacts

- name: Setup Release Information
run: |
echo "RELEASE_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Create GitHub Release
continue-on-error: false
run: |
# Find existing artifact files
hash_files=$(find ~/artifacts -name "*.sha256" -print0 | xargs -0 echo)
exe_files=$(find ~/artifacts -name "*.exe" -print0 | xargs -0 echo)
zip_files=$(find ~/artifacts -name "*.zip" -print0 | xargs -0 echo)
deb_files=$(find ~/artifacts -name "*.deb" -print0 | xargs -0 echo)
rpm_files=$(find ~/artifacts -name "*.rpm" -print0 | xargs -0 echo)

# Check existing release and delete if it's exist
if gh release view ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY &> /dev/null; then
gh release delete ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY
echo "${{ env.TAG_NAME }} deleted!"
fi

gh release create ${{ env.TAG_NAME }} \
--repo $GITHUB_REPOSITORY \
--draft \
--title "${{ env.RELEASE_NAME }}" \
--notes-file ~/artifacts/notes.txt \
$hash_files \
$exe_files \
$zip_files \
$deb_files \
$rpm_files

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = GCodeWorkShop
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2024.05
PROJECT_NUMBER = 2024.09

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
96 changes: 96 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Building GCodeWorkShop
======================

GCodeWorkShop is written in C++ using the Qt5 framework. In general,
the following steps are needed to build it:

- Install the C++11 compiler supported by [Qt SDK][1]. You should also
install the make utility.
- Install Qt utilities such as qmake, moc, lrelease and the resource packer.
- Install the Qt5 framework with version 5.6 or higher.
- Obtain and unzip the GCodeWorkShop source code.
- Create a build folder and navigate to it.
- Run qmake specifying the path to GCodeWorkShop sources.
- Run make to build the application.


Building in Debian
------------------

Install the following packages.

```
apt update
apt install build-essential qtbase5-dev qttools5-dev-tools libqt5serialport5-dev
```

Switch to the folder with sources. Now you can either build the application
step by step or use the script to automatically build the application and
create an installation package.


### Step-by-step build

```sh
mkdir -p build
cd build
qmake -r ..
make lrelease -j $(nproc)
qmake -r ..
make -j $(nproc)
```


### Automatically build and create an package

Run script:

```sh
install/deb-build.sh
```

The script creates a .deb package in the current folder and does not require
root privileges.


Building in windows with MSYS2
------------------------------

Install the following packages.

```sh
pacman -Syu
pacman -S make mingw-w64-x86_64-gcc mingw-w64-x86_64-nsis \
mingw-w64-x86_64-qt5-tools mingw-w64-x86_64-qt5-translations \
mingw-w64-x86_64-qt5-base mingw-w64-x86_64-qt5-serialport
```

Switch to the folder with sources. Now you can either build the application
step by step or use the script to automatically build the application and
create an installer.


### Step-by-step build

```sh
mkdir -p build
cd build
qmake -r ..
make lrelease -j $(nproc)
qmake -r ..
make -j $(nproc)
```


### Automatically build and create an installer

Run script:

```sh
install/win-msys2-build.sh
```

The script creates a .exe installer in the current folder.


[1]: https://doc.qt.io/qt-5/supported-platforms.html "Qt5 doc: supported platforms"
40 changes: 13 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ GCodeWorkShop
This is a fork of [EdytorNC](https://github.com/artur3/EdytorNC), a text editor
for CNC programmers.

- [Some features](#some-features)
- [Some shotcuts](#some-shotcuts)
- [Getting GCodeWorkShop](#getting-gcodeworkshop)
- [Command line options](#command-line-options)


Some features
------------
Expand Down Expand Up @@ -49,35 +54,16 @@ Some shotcuts
`SQRT(x)` `SQR(x)` `ABS(x)` `TRUNC(x)` `PI`


Getting GCodeWorkShop
---------------------

On the [release page](https://github.com/GCodeProjects/GCodeWorkShop/releases/latest)
you can find binary builds for Debian, Ubuntu and Windows. For building the
application yourself, the [build instructions](INSTALL.md) may be useful.


Command line options
------------------

- open file -> `gcodeworkshop file.nc`
- diff two files -> `gcodeworkshop -diff file1.nc file2.nc`


Compile GCodeWorkShop
-------------------


### Ubuntu

run terminal
```
sudo apt install qt5-default qtbase5-dev-tools qt5-qmake
cd ~
git clone https://github.com/GCodeProjects/GCodeWorkShop
cd GCodeWorkShop
qmake -r [CONFIG+=debug] [PREFIX=/usr/ | PREFIX=~/.local/bin/]
make
make lrelease
```


### Windows

- [Install Qt5](http://www.qt.io/download-open-source)
- download latest version of GCodeWorkShop [source files](https://github.com/GCodeProjects/GCodeWorkShop/archive/master.zip)
- unzip downloaded file
- open gcodeworkshop.pro in Qt Creator
- press Ctrl+R
17 changes: 17 additions & 0 deletions common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,20 @@ defineReplace(tsFiles) {

return ($$file_list)
}

defineReplace(getVersion) {
version_file = gcodeshared/include/version.h
!exists ($${PROJECT_ROOT_PATH}/$${version_file}): error(In function getVersion: File \"$${version_file}\" not found)
version_header = $$cat($${PROJECT_ROOT_PATH}/$${version_file}, lines)

for (str, version_header) {
sub_str=$$split(str, " ")

contains (sub_str, GCODEWORKSHOP_VERSION) {
ver_str=$$find(sub_str, '".*"')
!isEmpty(ver_str): return ($$split(ver_str, '"'))
}
}

error(In function getVersion: GCODEWORKSHOP_VERSION not found in $${version_file})
}
10 changes: 7 additions & 3 deletions gcodefileserver/gcodefileserver.pro
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# GCoderFileServer

VERSION = 0.1.0.0
TEMPLATE = app
TARGET = gcodefileserver

include(../common.pri)

QT *= widgets serialport network
MODULES *= kdiff3 qtsingleapplication GCodeShared

include(../common.pri)

defined(VERSION, var) {
# Define the version as a string literal
# https://stackoverflow.com/a/2411008
DEFINES += 'GCODEWORKSHOP_VERSION=\\"$$VERSION\\"'
} else {
VERSION = $$getVersion()
}

SOURCES = \
filechecker.cpp \
Expand Down
2 changes: 1 addition & 1 deletion gcodeshared/include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define VERSION_H

#ifndef GCODEWORKSHOP_VERSION
#define GCODEWORKSHOP_VERSION "2024.05"
#define GCODEWORKSHOP_VERSION "2024.09"
#endif

#endif // VERSION_H
Loading
Loading