Skip to content
Merged
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
10 changes: 10 additions & 0 deletions .fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--input-type zip
--output-type deb
--name "zsv"
--version "0.0.0"
--architecture "amd64"
--description "zsv+lib: tabular data swiss-army knife CLI + world's fastest (simd) CSV parser"
--maintainer "Liquidaty"
--url "https://github.com/liquidaty/zsv"
--license "MIT"
--prefix "/usr/local/"
90 changes: 71 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ jobs:
env:
TAG: ${{ needs.tag.outputs.TAG }}

outputs:
TAG: ${{ needs.tag.outputs.TAG }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -256,6 +259,44 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
run: ./scripts/ci-upload-release-artifacts.sh

prepare-linux-packages:
if: ${{ github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/v') }}
needs: [ci-linux]
runs-on: ubuntu-latest

env:
TAG: ${{ needs.ci-linux.outputs.TAG }}
AMD64_ZIP: zsv-${{ needs.ci-linux.outputs.TAG }}-amd64-linux-gcc.zip

steps:
- name: Download ${{ env.AMD64_ZIP }}
uses: actions/download-artifact@v4
with:
name: ${{ env.AMD64_ZIP }}
path: ${{ env.ARTIFACT_DIR }}

- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.fpm
scripts/ci-prepare-deb-rpm-repos.sh

- name: Install dependencies
run: |
sudo apt update
sudo apt install -y rpm dpkg-dev createrepo-c
sudo gem install --no-document fpm

- name: Set deb and rpm names as env vars
run: ./scripts/ci-prepare-deb-rpm-repos.sh

- name: Upload packages artifact
uses: actions/upload-artifact@v4
with:
name: packages
path: ${{ env.ARTIFACT_DIR }}/packages

ci-macos:
needs: [tag, clang-format, cppcheck, shellcheck]

Expand Down Expand Up @@ -374,7 +415,7 @@ jobs:
uses: actions/checkout@v4

- name: Build (${{ env.AMD64_FREEBSD_GCC }})
uses: cross-platform-actions/action@v0.28.0
uses: cross-platform-actions/action@v0.29.0
env:
PREFIX: ${{ env.AMD64_FREEBSD_GCC }}
CC: gcc
Expand Down Expand Up @@ -610,19 +651,6 @@ jobs:
export LDFLAGS="-L$PWD/app/external/mingw-ncurses/lib"
./scripts/ci-build.sh

# - name: Prepare build artifacts for upload
# run: ./scripts/ci-prepare-artifacts-for-upload.sh

# - name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_WSL_MINGW }}.zip)
# uses: actions/upload-artifact@v4
# env:
# ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_WSL_MINGW }}.zip
# with:
# name: ${{ env.ARTIFACT_NAME }}
# path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
# retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
# if-no-files-found: error

ci-musl:
needs: [tag, clang-format, cppcheck, shellcheck]
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -762,7 +790,7 @@ jobs:
ghcr.io/liquidaty/zsv:${{ env.TAG }}
ghcr.io/liquidaty/zsv:latest

ci-wasm:
ci-wasm-playground:
needs: [tag, clang-format, cppcheck, shellcheck]
runs-on: ubuntu-22.04
timeout-minutes: 15
Expand Down Expand Up @@ -812,15 +840,39 @@ jobs:
mkdir -p playground/non-simd
cp "$PREFIX"/bin/cli.em.{js,wasm} playground/non-simd

- name: Upload playground artifact
uses: actions/upload-artifact@v4
with:
name: playground
path: playground

upload-github-pages-artifact:
if: ${{ github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/v') }}
needs: [prepare-linux-packages, ci-wasm-playground]
runs-on: ubuntu-latest

steps:
- name: Download packages artifact
uses: actions/download-artifact@v4
with:
name: packages
path: ${{ env.ARTIFACT_DIR }}/packages

- name: Download playground artifact
uses: actions/download-artifact@v4
with:
name: playground
path: ${{ env.ARTIFACT_DIR }}

- name: Upload GitHub Pages artifacts
uses: actions/upload-pages-artifact@v3
with:
path: playground
path: ${{ env.ARTIFACT_DIR }}

deploy-wasm-playground:
deploy-to-github-pages:
if: ${{ github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/v') }}
needs: ci-wasm
runs-on: ubuntu-22.04
needs: [upload-github-pages-artifact]
runs-on: ubuntu-latest

permissions:
pages: write
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,36 @@ sudo port install zsv

#### Linux

##### Linux: `apt`

```shell
# Add repository
echo "deb [trusted=yes] https://liquidaty.github.io/zsv/packages/apt/amd64/ ./" | \
sudo tee /etc/apt/sources.list.d/zsv.list

# Install package
sudo apt update
sudo apt install zsv
```

##### Linux: `rpm`

```shell
# Add repository
sudo tee /etc/yum.repos.d/zsv.repo << EOF
[zsv]
name=zsv
baseurl=https://liquidaty.github.io/zsv/packages/rpm/amd64
enabled=1
gpgcheck=0
EOF

# Install package
sudo yum install zsv
```

To install the manually downloaded `deb`/`rpm`, follow these instructions:

For Linux (Debian/Ubuntu - `*.deb`):

```shell
Expand Down
79 changes: 79 additions & 0 deletions scripts/ci-prepare-deb-rpm-repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/sh

set -e

echo "[INF] Running $0"

if [ "$TAG" = "" ] || [ "$AMD64_ZIP" = "" ] || [ "$ARTIFACT_DIR" = "" ]; then
echo "[ERR] One or more environment variable(s) are not set!"
echo "[ERR] Set TAG, AMD64_ZIP and ARTIFACT_DIR before running $0 script."
exit 1
fi

if [ ! -f "$AMD64_ZIP" ]; then
echo "[ERR] $AMD64_ZIP file not found!"
echo "[ERR] Make sure the artifact is downloaded before running $0 script."
exit 1
fi

if [ ! -f ".fpm" ]; then
echo "[ERR] .fpm file not found!"
exit 1
fi

AMD64_DEB="zsv_${TAG}_amd64.deb"
AMD64_RPM="zsv-$(echo "$TAG" | tr '-' '_')-1.x86_64.rpm"

echo "[INF] TAG: $TAG"
echo "[INF] AMD64_ZIP: $AMD64_ZIP"
echo "[INF] ARTIFACT_DIR: $ARTIFACT_DIR"
echo "[INF] AMD64_DEB: $AMD64_DEB"
echo "[INF] AMD64_RPM: $AMD64_RPM"

cd "$ARTIFACT_DIR"

echo "[INF] Building DEB package"
fpm \
--fpm-options-file ../.fpm \
--architecture "amd64" \
--version "$TAG" \
--force \
"$AMD64_ZIP"
dpkg --info "$AMD64_DEB"
dpkg --contents "$AMD64_DEB"
ls -hl "$AMD64_DEB"

echo "[INF] Building RPM package"
fpm \
--fpm-options-file ../.fpm \
--output-type rpm \
--architecture "amd64" \
--version "$TAG" \
--force \
"$AMD64_ZIP"
rpm -qip "$AMD64_RPM"
rpm -qlp "$AMD64_RPM"
ls -hl "$AMD64_RPM"

rm -rf ./packages

echo "[INF] Moving deb and rpm files to packages directory"
mkdir -p packages/apt/amd64
mv "$AMD64_DEB" packages/apt/amd64/
ls -hl packages/apt/amd64

mkdir -p packages/rpm/amd64
mv "$AMD64_RPM" packages/rpm/amd64/
ls -hl packages/rpm/amd64

echo "[INF] Updating APT repository"
cd packages/apt/amd64
dpkg-scanpackages . /dev/null > Packages
gzip -k -f Packages
apt-ftparchive release . > Release
cd -

echo "[INF] Updating RPM repository"
createrepo_c packages/rpm/amd64

echo "[INF] --- [DONE] ---"