From b235da76bd69ab244413c2d785f4a653c499d639 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Wed, 31 Jan 2024 23:13:22 +0300 Subject: [PATCH 1/3] init ci --- .github/workflows/build.sh | 51 +++++++++++++++++++++++++++++++++++++ .github/workflows/build.yml | 32 +++++++++++++++++++++++ build_deb.sh | 0 3 files changed, 83 insertions(+) create mode 100755 .github/workflows/build.sh create mode 100644 .github/workflows/build.yml mode change 100644 => 100755 build_deb.sh diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh new file mode 100755 index 0000000..146580d --- /dev/null +++ b/.github/workflows/build.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$NAME +elif [ -f /etc/lsb-release ]; then + . /etc/lsb-release + OS=$DISTRIB_ID +else + OS=$(uname -s) +fi + +case $OS in + "Ubuntu") + echo Ubuntu + apt-get update + apt-get install -y jq curl p7zip-full nodejs npm unzip + npm install -g @electron/asar + ./build_deb.sh + + mkdir dist + mv deb/*.deb dist + ;; + "Arch Linux") + echo "Arch Linux" + pacman -Syy --noconfirm + pacman -S --noconfirm git sudo base-devel p7zip nodejs jq npm electron libpulse + # fix access + mkdir /.npm + chown -R 65534:65534 "/.npm" + # fix "asar: command not found" + npm install -g @electron/asar + # fix makepkg from non-root + mkdir /home/build + chgrp nobody /home/build + chmod g+ws /home/build + setfacl -m u::rwx,g::rwx /home/build + setfacl -d --set u::rwx,g::rwx,o::- /home/build + chown nobody . + sudo -u nobody makepkg --log + + mkdir dist + mv *.pkg.tar.zst dist + ;; + "NixOS") + # TODO + ;; + *) + echo "Operating system is not recognized." + ;; +esac \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..690ec7b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: Build + +on: + pull_request: + branches: + - '*' + push: + branches: + - 'main' + + +jobs: + build: + strategy: + matrix: + container: + - ubuntu:22.04 + - archlinux:latest + runs-on: ubuntu-latest + container: + image: ${{ matrix.container }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build + run: ./.github/workflows/build.sh + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + path: ./dist/* \ No newline at end of file diff --git a/build_deb.sh b/build_deb.sh old mode 100644 new mode 100755 From 709af84967653954378d131c54855d4f6b22dfe3 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Thu, 1 Feb 2024 00:07:07 +0300 Subject: [PATCH 2/3] add nix build --- .github/workflows/build.sh | 7 ++++--- .github/workflows/build.yml | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh index 146580d..8c45be2 100755 --- a/.github/workflows/build.sh +++ b/.github/workflows/build.sh @@ -42,9 +42,10 @@ case $OS in mkdir dist mv *.pkg.tar.zst dist ;; - "NixOS") - # TODO - ;; +# "NixOS") +# echo NixOS +# nix build +# ;; *) echo "Operating system is not recognized." ;; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 690ec7b..39a2d3c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,4 +29,20 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - path: ./dist/* \ No newline at end of file + path: ./dist/* + nix-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install nix + uses: cachix/install-nix-action@v22 + + - name: Build + run: nix build + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + path: ./result/* \ No newline at end of file From 3a8857efb836d4f505baf3655d21bd176ae3e0b3 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Thu, 1 Feb 2024 18:40:07 +0300 Subject: [PATCH 3/3] change to sh --- .github/workflows/build.sh | 2 +- .github/workflows/build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh index 8c45be2..01f988a 100755 --- a/.github/workflows/build.sh +++ b/.github/workflows/build.sh @@ -16,7 +16,7 @@ case $OS in apt-get update apt-get install -y jq curl p7zip-full nodejs npm unzip npm install -g @electron/asar - ./build_deb.sh + sh ./build_deb.sh mkdir dist mv deb/*.deb dist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39a2d3c..aaaabca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@v4 - name: Build - run: ./.github/workflows/build.sh + run: sh ./.github/workflows/build.sh - name: Upload artifact uses: actions/upload-artifact@v4