Skip to content

Commit

Permalink
Merge pull request #1061 from Morganamilo/ci2
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo authored Oct 31, 2023
2 parents 67cc6f4 + 4942757 commit 437dc36
Show file tree
Hide file tree
Showing 69 changed files with 1,333 additions and 888 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
paru.tar.*
153 changes: 60 additions & 93 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,115 +4,82 @@ on:
tags:
- v*
branches:
- release/*
- test-release/*

jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- id: version
run: echo "version=${ref##test-release/}" >> $GITHUB_OUTPUT
env:
ref: ${{ github.ref_name }}

build-releases:
name: Build release
runs-on: ubuntu-latest
strategy:
matrix:
arch:
[
"linux/amd64 x86_64",
"linux/arm64/v8 aarch64",
"linux/arm/v7 armv7h"
]
name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest
platform:
- docker: amd64
arch: x86_64
- docker: arm64/v8
arch: aarch64
- docker: arm/v7
arch: armv7h

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Read info
id: tags
shell: bash
run: |
arch="${{ matrix.arch }}"
echo ::set-output name=PLATFORM::${arch%% *}
echo ::set-output name=ARCH::${arch##* }
- name: Build ${{ matrix.arch }} release
shell: bash
run: |
arch="${{ matrix.arch }}"
PLATFORM=${arch%% *}
ARCH=${arch##* }
mkdir artifacts
docker buildx build --platform $PLATFORM \
--tag paru:$ARCH \
--load \
.
docker create --name paru-$ARCH paru:$ARCH
docker cp paru-$ARCH:/app/paru.tar.zst paru-$ARCH.tar.zst
docker container rm paru-$ARCH
mv paru-*.tar.zst artifacts
- uses: actions/upload-artifact@v2
install: true
- run: docker build --platform=linux/${{ matrix.platform.docker }} -o . .
- uses: actions/upload-artifact@v3
with:
name: paru-${{ steps.tags.outputs.arch }}
path: artifacts
name: paru-${{ matrix.platform.arch }}
path: paru.tar.zst

create_release:
name: Create release from this build
needs: [build-releases]
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build-releases, get-version]
outputs:
release-url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Read info
id: tags
shell: bash
run: |
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
- uses: actions/download-artifact@v2
with:
name: paru-x86_64
- uses: actions/download-artifact@v2
with:
name: paru-aarch64
- uses: actions/download-artifact@v2
with:
name: paru-armv7h
- name: Create Release
id: create_release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tags.outputs.tag }}
release_name: ${{ steps.tags.outputs.tag }}
draft: true
prerelease: false
- name: Upload x86_64 asset
id: upload-release-asset-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./paru-x86_64.tar.zst
asset_name: paru-${{ steps.tags.outputs.tag }}-x86_64.tar.zst
asset_content_type: application/tar+zstd
- name: Upload aarch64 asset
id: upload-release-asset-aarch64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create-release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.get-version.outputs.version }}
release_name: Paru v${{ needs.get-version.outputs.version }}
draft: true
prerelease: false

upload-binaries:
name: Upload binaries to Githib relase
runs-on: ubuntu-latest
needs: [release, get-version]
strategy:
matrix:
arch: [x86_64, aarch64, armv7h]
steps:
- uses: actions/download-artifact@v3
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./paru-aarch64.tar.zst
asset_name: paru-${{ steps.tags.outputs.tag }}-aarch64.tar.zst
asset_content_type: application/tar+zstd
- name: Upload armv7h asset
id: upload-release-asset-armv7h
uses: actions/upload-release-asset@v1
name: paru-${{ matrix.arch }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./paru-armv7h.tar.zst
asset_name: paru-${{ steps.tags.outputs.tag }}-armv7h.tar.zst
upload_url: ${{ needs.release.outputs.release-url }}
asset_name: paru-${{ needs.get-version.outputs.version }}-${{ matrix.arch }}.tar.zst
asset_path: paru.tar.zst
asset_content_type: application/tar+zstd

2 changes: 1 addition & 1 deletion .github/workflows/mo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: sudo apt-get install gettext

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

- name: Build translations
run: ./scripts/mkmo locale
4 changes: 2 additions & 2 deletions .github/workflows/paru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: cargo build --locked --features generate

- name: Test
run: sudo -u nobody BUILDDIR=/tmp PKGDEST=/tmp SRCDEST=/tmp CARGO_HOME=/tmp/cargo cargo test --locked --features generate,mock --target-dir=/tmp -- --test-threads=1
run: sudo -u nobody BUILDDIR=/tmp PKGDEST=/tmp SRCDEST=/tmp CARGO_HOME=/tmp/cargo cargo test --locked --features generate,mock --target-dir=/tmp -- --test-threads=1 --nocapture

test-git:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,4 +65,4 @@ jobs:
run: cargo build --locked --features git,generate

- name: Test
run: sudo -u nobody BUILDDIR=/tmp PKGDEST=/tmp SRCDEST=/tmp CARGO_HOME=/tmp/cargo cargo test --locked --features git,generate,mock --target-dir=/tmp -- --test-threads=1
run: sudo -u nobody BUILDDIR=/tmp PKGDEST=/tmp SRCDEST=/tmp CARGO_HOME=/tmp/cargo cargo test --locked --features git,generate,mock --target-dir=/tmp -- --test-threads=1 --nocapture
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
paru.tar.*
po/*.mo
locale/
testdata/pkg/*
9 changes: 3 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ feature. Then running with **LD_LIBRARY_PATH** pointed at the custom libalpm.so.
Paru's test suite can be run by running:

```
cargo test --features mock -- --test-threads=1
cargo test --features mock
```

## Translating
Expand Down Expand Up @@ -65,15 +65,12 @@ Alternatively, you can use programs like `poedit` to write the translations.

### Updating existing translations

To update existing translations against new code you must first update the
template file then update the .po files.
To update existing translations against new code you must first update the .po
files.

Do this as its own commit.

Updating the template requires [xtr](https://github.com/woboq/tr) to be installed.

```
./scripts/mkpot
./scripts/updpo
git commit po
```
Expand Down
8 changes: 5 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ srcinfo = "1.1.0"


ansi_term = "0.12.1"
anyhow = "1.0.68"
anyhow = { version = "1.0.68", features = ["backtrace"] }
chrono = { version = "0.4.23", default-features = false, features = ["clock"] }
dirs = "5.0.1"
futures = "0.3.25"
Expand Down Expand Up @@ -69,10 +69,12 @@ generate = ["alpm/generate"]
static = ["alpm/static"]
mock = ["async-trait"]
mock_chroot = ["mock"]
#default = ["git", "generate"]

[patch.crates-io]
#alpm = { path = "../alpm.rs/alpm" }
alpm = { git = "https://github.com/archlinux/alpm.rs", rev = "101b05" }
alpm-utils = { git = "https://github.com/archlinux/alpm.rs", rev = "101b05" }
#aur-depends = { path = "../aur-depends" }
aur-depends = { git = "https://github.com/Morganamilo/aur-depends", rev = "c36167" }
aur-depends = { git = "https://github.com/Morganamilo/aur-depends"}
#aur-fetch = { path = "../aur-fetch" }
42 changes: 35 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
FROM lopsided/archlinux:devel
FROM debian:unstable as build-stage

WORKDIR /app
ARG PACMAN_VER=6.0.2
ARG DEBIAN_FRONTEND=noninteractive

WORKDIR /pacman

RUN apt-get update -y
RUN apt-get install -y build-essential git libcurl4-openssl-dev curl meson ninja-build \
libarchive-dev pkg-config libgpgme-dev libssl-dev clang python3 python3-setuptools \
gettext zstd

RUN curl -O https://sources.archlinux.org/other/pacman/pacman-${PACMAN_VER}.tar.xz
RUN tar -xf pacman-${PACMAN_VER}.tar.xz

WORKDIR pacman-${PACMAN_VER}

RUN meson setup \
--prefix=/usr \
--buildtype=plain \
build

RUN ninja -C build
RUN ninja -C build install

WORKDIR /paru

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --no-modify-path --profile minimal --default-toolchain nightly

COPY ../ .

RUN pacman -Sy --noconfirm archlinux-keyring
RUN pacman -Su --noconfirm rustup
RUN rustup default nightly
RUN --mount=type=tmpfs,target=/root/.cargo ./scripts/dist
RUN ./scripts/dist
RUN --mount=type=tmpfs,target=/usr/local/cargo/git ./scripts/dist

FROM scratch AS export-stage
COPY --from=build-stage /paru/paru.tar.zst /
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md).

`paru --gendb` -- Generate the devel database for tracking `*-git` packages. This is only needed when you initially start using paru.

`paru -Ui` -- Build and install a PKGBUILD in the current directory.
`paru -Bi .` -- Build and install a PKGBUILD in the current directory.

## IRC

Expand Down
22 changes: 22 additions & 0 deletions man/paru.8
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,28 @@ Additionally, a, r and p may be used as short hand for aur, repo and pkgbuilds r
Short form modes can also be combined without a comma.
E.g. \fB--mode=ar\fR or \fB--mode=arp\fR.


.TP
.B \-\-interactive
Enable interactive package selection for -S, -R, -Ss and -Qs.

For -S/-R this allows you to pick which packages to install/remove from a list.

\fB paru <foo>\fR is an alias to \fBparu -S --interactive <foo>\fR.

For -Ss/-Qs this allows you to interactivly pick packages from the sync/local repos respectively.
This is intended to be chained with other package tools so paru can handle the menu work while the
other tool in the pipeline just gets the packages.

For example:

\fB paru -Ssaq --interactive ruby | paru -Gc -\fR

will show AUR packages containing the term ruby, give the user an interactive menu to pick packages, then pipeline
those packages into -Gc and display the comments.

Would allow a user to interactivly choose what files to list.

.TP
.B \-\-aururl
Set an alternative AUR URL.
Expand Down
9 changes: 6 additions & 3 deletions scripts/dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh
#!/bin/bash
set -e
cargo build --release --locked --target-dir target -Z sparse-registry

cargo build --release --features generate --locked --target-dir target
scripts/mkmo locale/
strip target/release/paru
tar --zstd -cfparu.tar.zst man completions paru.conf locale -C target/release paru

tar --zstd -cf paru.tar.zst man completions paru.conf locale -C target/release paru

2 changes: 1 addition & 1 deletion scripts/mkmo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e

if [ -z "$1" ]; then
Expand Down
Loading

0 comments on commit 437dc36

Please sign in to comment.