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

CI: updated AUR package flavors #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
70 changes: 66 additions & 4 deletions .github/workflows/aur_upload.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Upload AUR

on:
release:
types: [created]

jobs:
build:
tpi-bin:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: generate PKGBUILD
run: |
cp scripts/ci/PKGBUILD .
PACKAGE_NAME=$(grep '^name =' Cargo.toml | sed 's/name = "\(.*\)"/\1/')
cp scripts/ci/PKGBUILD.bin ./PKGBUILD
PACKAGE_NAME=$(grep '^name =' Cargo.toml | sed 's/name = "\(.*\)"/\1/')-bin
VERSION=$(grep '^version =' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
MAINTAINER=$(grep '^authors =' Cargo.toml | sed 's/authors = \[\s*"\(.*\)\s*"\]/\1/')
DESCRIPTION=$(grep '^description =' Cargo.toml | sed 's/description = "\(.*\)"/\1/')
Expand All @@ -37,3 +36,66 @@ jobs:
commit_email: '[email protected]'
ssh_private_key: ${{ secrets.AUR_DEPLOY_KEY }}
commit_message: Update package to ${{ env.VERSION }}

tpi-src:
runs-on: ubuntu-latest
strategy:
matrix:
name:
- master
- git
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: generate PKGBUILD
run: |
cp scripts/ci/PKGBUILD ./PKGBUILD
PACKAGE_NAME=$(grep '^name =' Cargo.toml | sed 's/name = "\(.*\)"/\1/')
VERSION=$(grep '^version =' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
MAINTAINER=$(grep '^authors =' Cargo.toml | sed 's/authors = \[\s*"\(.*\)\s*"\]/\1/')
DESCRIPTION=$(grep '^description =' Cargo.toml | sed 's/description = "\(.*\)"/\1/')
if [[ ${{ matrix.name }} == "master" ]]; then
TAG=""
PACKAGE_NAME=${PACKAGE_NAME}-git
cat << 'EOF' >> PKGBUILD
pkgver() {
cd tpi
git describe --long --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
EOF
else
TAG="#tag=v${VERSION}"
sed -i "3i pkgver=${VERSION}" PKGBUILD
fi
sed -i "1i # Maintainer: ${MAINTAINER}" PKGBUILD
sed -i "2i pkgname=${PACKAGE_NAME}" PKGBUILD
sed -i "4i pkgdesc='${DESCRIPTION}'" PKGBUILD
sed -i "5i source=(\"git+https://github.com/turing-machines/tpi.git${TAG}\")" PKGBUILD

install=$(cat scripts/ci/install)
cat << EOF >> PKGBUILD
package() {
TARGET=\$CARCH-unknown-linux-gnu
pkgname=tpi
$install
}
EOF
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "PKG_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
- run: cat ./PKGBUILD
- name: Create AUR package
uses: addnab/docker-run-action@v3
with:
registry: ghcr.io
image: 'ghcr.io/heyhusen/archlinux-package-action:latest'
options: -v ${{ github.workspace }}:/workspace --entrypoint=""
run: /workspace/scripts/ci/entry_point.sh
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v3
with:
pkgname: ${{ env.PKG_NAME }}
pkgbuild: ./PKGBUILD
commit_username: 'Github automation'
commit_email: '[email protected]'
ssh_private_key: ${{ secrets.AUR_DEPLOY_KEY }}
commit_message: Update package to ${{ env.VERSION }}
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Toolchain
uses: actions-rs/toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tpi"
version = "1.0.7"
edition = "2021"
license = "Apache-2.0"
authors = ["Sven Rademakers <sven@turingpi.com>"]
authors = ["Sven Rademakers <sven.rademakers@gmail.com>"]
description = "Official Turing-Pi2 CLI tool"
homepage = "https://turingpi.com/"
repository = "https://github.com/turing-machines/tpi"
Expand Down
32 changes: 22 additions & 10 deletions scripts/ci/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
pkgname=
pkgver=
pkgrel=1
pkgdesc=
pkgrel=3
url=https://turingpi.com/
license=('Apache')
arch=('x86_64' 'aarch64')
source_x86_64=("https://github.com/turing-machines/tpi/releases/download/v${pkgver}/tpi-x86_64-unknown-linux-gnu.tar.gz")
source_aarch64=("https://github.com/turing-machines/tpi/releases/download/v${pkgver}/tpi-aarch64-unknown-linux-gnu.tar.gz")
license=('Apache-2.0')
makedepends=('cargo' 'git')
arch=('x86_64' 'aarch64' 'armv7h')
options=(!lto)

package() {
tar -xzf "${srcdir}/tpi-${CARCH}-unknown-linux-gnu.tar.gz" -C "${pkgdir}"
prepare() {
cd tpi
export RUSTUP_TOOLCHAIN=stable
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
cd tpi
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --frozen --release --target "$CARCH-unknown-linux-gnu"
}

check() {
cd tpi
export RUSTUP_TOOLCHAIN=stable
cargo test --frozen
}
13 changes: 13 additions & 0 deletions scripts/ci/PKGBUILD.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pkgname=
pkgver=
pkgrel=1
pkgdesc=
url=https://turingpi.com/
license=('Apache-2.0')
arch=('x86_64' 'aarch64')
source_x86_64=("https://github.com/turing-machines/tpi/releases/download/v${pkgver}/tpi-x86_64-unknown-linux-gnu.tar.gz")
source_aarch64=("https://github.com/turing-machines/tpi/releases/download/v${pkgver}/tpi-aarch64-unknown-linux-gnu.tar.gz")

package() {
tar -xzf "${srcdir}/tpi-${CARCH}-unknown-linux-gnu.tar.gz" -C "${pkgdir}"
}
17 changes: 17 additions & 0 deletions scripts/ci/entry_point.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
work_dir=/home/builder/gh-action

echo "::group::Copying files from /workspace to $work_dir"
mkdir -p $work_dir
cp -rfv /workspace/* $work_dir
cd $work_dir
echo "::endgroup::"

echo "::group::Updating PKGBUID"
updpkgsums
makepkg -g >> PKGBUILD
makepkg --printsrcinfo >.SRCINFO

sudo cp -f PKGBUILD /workspace
sudo cp -f .SRCINFO /workspace
echo "::endgroup::"
6 changes: 3 additions & 3 deletions scripts/ci/install
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mkdir -p ${pkgdir}/usr/bin
mkdir -p ${pkgdir}/usr/share/doc/tpi
install -m 755 ${srcdir}/target/${TARGET}/release/tpi ${pkgdir}/usr/bin/tpi
install -m 644 ${srcdir}/README.md ${pkgdir}/usr/share/doc/tpi/README.md
install -m 644 ${srcdir}/LICENSE ${pkgdir}/usr/share/doc/tpi/copyright
install -m 755 ${srcdir}/${pkgname}/target/${TARGET}/release/tpi ${pkgdir}/usr/bin/tpi
install -m 644 ${srcdir}/${pkgname}/README.md ${pkgdir}/usr/share/doc/tpi/README.md
install -m 644 ${srcdir}/${pkgname}/LICENSE ${pkgdir}/usr/share/doc/tpi/copyright

Loading