From 7b17fde44c5f095b9d312fbb3a9b16ccc5668364 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Thu, 29 Aug 2024 01:11:00 +0300 Subject: [PATCH] add packaging --- .github/build-canary-v3 | 1 + .github/build-nest-v3 | 1 + .github/release-canary-v3 | 1 + .github/release-nest-v3 | 1 + .github/workflows/build-canaryv3.yml | 37 +++++++++++++++++++++ .github/workflows/build-nestv3.yml | 37 +++++++++++++++++++++ .github/workflows/release-canaryv3.yml | 40 ++++++++++++++++++++++ .github/workflows/release-nestv3.yml | 40 ++++++++++++++++++++++ .github/workflows/release.yml | 46 -------------------------- debian/rules | 42 +++++++++++++++++++++-- main.sh | 25 ++++++++++---- 11 files changed, 216 insertions(+), 55 deletions(-) create mode 100644 .github/build-canary-v3 create mode 100644 .github/build-nest-v3 create mode 100644 .github/release-canary-v3 create mode 100644 .github/release-nest-v3 create mode 100644 .github/workflows/build-canaryv3.yml create mode 100644 .github/workflows/build-nestv3.yml create mode 100644 .github/workflows/release-canaryv3.yml create mode 100644 .github/workflows/release-nestv3.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/build-canary-v3 b/.github/build-canary-v3 new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/.github/build-canary-v3 @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/.github/build-nest-v3 b/.github/build-nest-v3 new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/.github/build-nest-v3 @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/.github/release-canary-v3 b/.github/release-canary-v3 new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/.github/release-canary-v3 @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/.github/release-nest-v3 b/.github/release-nest-v3 new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/.github/release-nest-v3 @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/.github/workflows/build-canaryv3.yml b/.github/workflows/build-canaryv3.yml new file mode 100644 index 0000000..bff3d86 --- /dev/null +++ b/.github/workflows/build-canaryv3.yml @@ -0,0 +1,37 @@ +name: PikaOS Package Build Only (Canary) (amd64-v3) + +on: + push: + branches: + - main + paths: + - '.github/build-canary-v3' + +jobs: + build: + runs-on: ubuntu-latest + container: + image: ghcr.io/pikaos-linux/pikaos-builder:canaryv3 + volumes: + - /proc:/proc + options: --privileged -it + + steps: + - uses: actions/checkout@v3 + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + name: id_rsa + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + + - name: Update APT Cache + run: apt-get update -y + + - name: Set Build Config + run: cp -vf ./pika-build-config/amd64-v3.sh ./pika-build-config.sh + + - name: Build Package + run: ./main.sh diff --git a/.github/workflows/build-nestv3.yml b/.github/workflows/build-nestv3.yml new file mode 100644 index 0000000..3c9c34d --- /dev/null +++ b/.github/workflows/build-nestv3.yml @@ -0,0 +1,37 @@ +name: PikaOS Package Build Only (amd64-v3) + +on: + push: + branches: + - main + paths: + - '.github/build-nest-v3' + +jobs: + build: + runs-on: ubuntu-latest + container: + image: ghcr.io/pikaos-linux/pikaos-builder:nestv3 + volumes: + - /proc:/proc + options: --privileged -it + + steps: + - uses: actions/checkout@v3 + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + name: id_rsa + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + + - name: Update APT Cache + run: apt-get update -y + + - name: Set Build Config + run: cp -vf ./pika-build-config/amd64-v3.sh ./pika-build-config.sh + + - name: Build Package + run: ./main.sh diff --git a/.github/workflows/release-canaryv3.yml b/.github/workflows/release-canaryv3.yml new file mode 100644 index 0000000..436c8ff --- /dev/null +++ b/.github/workflows/release-canaryv3.yml @@ -0,0 +1,40 @@ +name: PikaOS Package Build & Release (Canary) (amd64-v3) + +on: + push: + branches: + - main + paths: + - '.github/release-canary-v3' + +jobs: + build: + runs-on: ubuntu-latest + container: + image: ghcr.io/pikaos-linux/pikaos-builder:canaryv3 + volumes: + - /proc:/proc + options: --privileged -it + + steps: + - uses: actions/checkout@v3 + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + name: id_rsa + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + + - name: Update APT Cache + run: apt-get update -y + + - name: Set Build Config + run: cp -vf ./pika-build-config/amd64-v3.sh ./pika-build-config.sh + + - name: Build Package + run: ./main.sh + + - name: Release Package + run: ./release.sh diff --git a/.github/workflows/release-nestv3.yml b/.github/workflows/release-nestv3.yml new file mode 100644 index 0000000..ed42bb7 --- /dev/null +++ b/.github/workflows/release-nestv3.yml @@ -0,0 +1,40 @@ +name: PikaOS Package Build & Release (amd64-v3) + +on: + push: + branches: + - main + paths: + - '.github/release-nest-v3' + +jobs: + build: + runs-on: ubuntu-latest + container: + image: ghcr.io/pikaos-linux/pikaos-builder:nestv3 + volumes: + - /proc:/proc + options: --privileged -it + + steps: + - uses: actions/checkout@v3 + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + name: id_rsa + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + + - name: Update APT Cache + run: apt-get update -y + + - name: Set Build Config + run: cp -vf ./pika-build-config/amd64-v3.sh ./pika-build-config.sh + + - name: Build Package + run: ./main.sh + + - name: Release Package + run: ./release.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 1641898..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: PikaOS Package Release - -on: - workflow_dispatch - -jobs: - build: - runs-on: self-hosted - container: - image: ghcr.io/pikaos-linux/pika-package-container:latest - volumes: - - /proc:/proc - options: --privileged -it - - steps: - - uses: actions/checkout@v3 - - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.PASSPHRASE }} - - - name: Install SSH key - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_KEY }} - name: id_rsa - known_hosts: ${{ secrets.KNOWN_HOSTS }} - if_key_exists: replace - - - name: Build Package - run: ./main.sh - - - name: Release Package - run: ./release.sh - - - name: Purge cache - uses: strrife/cloudflare-chunked-purge-action@master - env: - # Zone is required by both authentication methods - CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} - - CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} - PURGE_URLS: ${{ vars.PURGE_URLS }} diff --git a/debian/rules b/debian/rules index 000210b..8bb4685 100755 --- a/debian/rules +++ b/debian/rules @@ -1,4 +1,42 @@ -#!/usr/bin/make -f +#! /usr/bin/make -f + +## See debhelper(7) (uncomment to enable). +## Output every command that modifies files on the build system. +export DH_VERBOSE = 1 + +export PIKA_BUILD_ARCH = $(shell cat ../pika-build-arch) +export PATH := $(PATH):/root/.cargo/bin + +override_dh_prep: +# amd64 build prep +ifeq (amd64-v3,$(PIKA_BUILD_ARCH)) +# Does not support LTO due to dylib-lto +#export RUSTFLAGS = -C target-cpu=x86-64-v3 -C lto=fat -C embed-bitcode -C codegen-units=1 -C opt-level=3 -Zdylib-lto +export RUSTFLAGS = -C target-cpu=x86-64-v3 -C opt-level=3 +endif %: - dh ${@} + dh $@ + +override_dh_auto_install: + /root/.cargo/bin/cargo fetch + /root/.cargo/bin/cargo build --release + +override_dh_install: + dh_install + mkdir -p $(DESTDIR)/usr/bin/ + mkdir -p $(DESTDIR)/usr/lib/pika/gnome-layouts + mkdir -p $(DESTDIR)/usr/share/glib-2.0/schemas/ + mkdir -p $(DESTDIR)/usr/share/applications + mkdir -p $(DESTDIR)/usr/share/icons/hicolor/scalable/apps + cp -vf target/release/pika-gnome-layouts $(DESTDIR)/usr/bin/ + cp -vf data/scripts/*.sh $(DESTDIR)/usr/lib/pika/gnome-layouts + cp -vf data/scripts/papirus-folders $(DESTDIR)/usr/lib/pika/gnome-layouts + cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/ + cp -vf data/com.github.pikaos-linux.pikagnomelayouts.desktop $(DESTDIR)/usr/share/applications/ + cp -vfr data/layout-scripts $(DESTDIR)/usr/lib/pika/gnome-layouts/ + cp -vfr data/polkit-1 $(DESTDIR)/usr/share/ + chmod 755 $(DESTDIR)/usr/bin/pika-gnome-layouts + chmod 755 $(DESTDIR)/usr/lib/pika/gnome-layouts/*.sh + chmod 755 $(DESTDIR)/usr/lib/pika/gnome-layouts/layout-scripts/*.sh + chmod 755 $(DESTDIR)/usr/lib/pika/gnome-layouts/papirus-folders \ No newline at end of file diff --git a/main.sh b/main.sh index a4afce1..1a6df84 100755 --- a/main.sh +++ b/main.sh @@ -1,17 +1,28 @@ +#! /bin/bash + +set -e + +VERSION="4.0.0" + +source ./pika-build-config.sh + +echo "$PIKA_BUILD_ARCH" > pika-build-arch + # Clone Upstream -mkdir -p ./pika-gnome-layouts -cp -rvf ./debian ./pika-gnome-layouts/ -cp -rvf ./usr ./pika-gnome-layouts/ -cd ./pika-gnome-layouts +mkdir -p pika-gnome-layouts +cp -rvf ./* ./pika-gnome-layouts/ || true +cd ./pika-gnome-layouts/ # Get build deps apt-get build-dep ./ -y +apt-get install curl -y +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | CARGO_HOME=/root/.cargo sh -s -- -y # Build package -dh_make --createorig -dpkg-buildpackage +LOGNAME=root dh_make --createorig -y -l -p pika-gnome-layouts_"$VERSION" || echo "dh-make: Ignoring Last Error" +dpkg-buildpackage --no-sign # Move the debs to output cd ../ mkdir -p ./output -mv ./*.deb ./output/ +mv ./*.deb ./output/ \ No newline at end of file