diff --git a/.github/workflows/build-appimage.yml b/.github/workflows/build-appimage.yml new file mode 100644 index 0000000..0abb217 --- /dev/null +++ b/.github/workflows/build-appimage.yml @@ -0,0 +1,48 @@ +name: Build AppImage + +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Set up CentOS 7 Docker + run: | + docker run --rm -v $(pwd):/workspace -w /workspace centos:7 /bin/bash -c " + yum install -y epel-release + yum groupinstall -y 'Development Tools' + yum install -y gtk3-devel glib2-devel gettext-devel desktop-file-utils \ + patchelf wget libtool autoconf automake pkgconfig + + wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + chmod +x linuxdeploy-x86_64.AppImage + + ./autogen.sh + ./configure + make + + ./linuxdeploy-x86_64.AppImage --appdir AppDir --init-appdir + cp src/xnec2c AppDir/usr/bin/ + cp resources/xnec2c.svg AppDir/usr/share/icons/hicolor/scalable/apps/ + cp files/xnec2c.desktop AppDir/usr/share/applications/ + ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage + mv *.AppImage xnec2c-${{ github.sha }}.AppImage + + chmod +x xnec2c-${{ github.sha }}.AppImage + ./xnec2c-${{ github.sha }}.AppImage --appimage-extract-and-run -h + " + + - name: Upload the AppImage + uses: actions/upload-artifact@v2 + with: + name: xnec2c.AppImage + path: xnec2c-${{ github.sha }}.AppImage diff --git a/.github/workflows/build-deb-packages.yml b/.github/workflows/build-deb-packages.yml new file mode 100644 index 0000000..78a318d --- /dev/null +++ b/.github/workflows/build-deb-packages.yml @@ -0,0 +1,46 @@ +name: Build DEB Packages + +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, debian-11, debian-10, debian-9] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up the build environment + run: | + sudo apt-get update + sudo apt-get install -y build-essential autoconf automake libtool \ + gtk3-dev libglib2.0-dev gettext desktop-file-utils devscripts fakeroot lintian + + - name: Build the DEB package using debuild + run: | + ./autogen.sh + ./configure + make + debuild -us -uc -b + + - name: Test DEB package + run: | + dpkg -i ../xnec2c_*.deb || true # Install DEB package + xnec2c -h # Run test + + - name: Upload the DEB package + uses: actions/upload-artifact@v2 + with: + name: xnec2c-${{ matrix.os }}.deb + path: ../xnec2c_*.deb diff --git a/.github/workflows/build-rpm-packages.yml b/.github/workflows/build-rpm-packages.yml new file mode 100644 index 0000000..72842b3 --- /dev/null +++ b/.github/workflows/build-rpm-packages.yml @@ -0,0 +1,74 @@ +name: Build RPM Packages + +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + os: [fedora-38, fedora-37, almalinux-9, almalinux-8] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache dnf packages + uses: actions/cache@v2 + with: + path: /var/cache/dnf + key: ${{ runner.os }}-dnf-${{ hashFiles('**/Dockerfile') }} + restore-keys: | + ${{ runner.os }}-dnf- + + - name: Determine version and dist + id: version + run: | + VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") + TAG=$(git describe --tags --exact-match 2>/dev/null || echo "notag") + if [ "$TAG" = "notag" ]; then + DIST="-git" + else + DIST="" + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "DIST=$DIST" >> $GITHUB_ENV + + - name: Build RPM packages in Docker + run: | + docker run --rm -v $(pwd):/workspace -w /workspace ${{ matrix.os }} /bin/bash -c " + sudo dnf install -y rpm-build make autoconf automake libtool gcc gettext-devel gtk3-devel desktop-file-utils glib2-devel intltool + ./autogen.sh + ./configure + make + mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS + mv . ~/rpmbuild/SOURCES/xnec2c-v${VERSION} + tar -czvf ~/rpmbuild/SOURCES/xnec2c-v${VERSION}.tar.gz -C ~/rpmbuild/SOURCES xnec2c-v${VERSION} + rpmbuild -ba -D \"_topdir $(pwd)/rpmbuild\" -D \"dist $DIST\" ~/rpmbuild/SPECS/xnec2c.spec + cp ~/rpmbuild/RPMS/x86_64/xnec2c-*.rpm ." + + - name: Test RPM Package + run: | + docker run --rm -v $(pwd):/workspace -w /workspace ${{ matrix.os }} /bin/bash -c " + sudo dnf install -y ./xnec2c-*.rpm + xnec2c -h" + + - name: Upload the RPM package + uses: actions/upload-artifact@v2 + with: + name: xnec2c-${{ matrix.os }}.rpm + path: xnec2c-*.rpm