Skip to content

Commit

Permalink
Merge branch 'main' into feat-context-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
br1tney5pear5 authored Jan 1, 2025
2 parents f5c92d2 + 9db4bd2 commit 1a22213
Show file tree
Hide file tree
Showing 36 changed files with 499 additions and 167 deletions.
175 changes: 93 additions & 82 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,9 @@ jobs:
- name: Run shellcheck
run: ./scripts/ci-run-shellcheck.sh

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

strategy:
matrix:
os: [ubuntu-22.04, macos-13, macos-14]

runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
timeout-minutes: 15

env:
Expand All @@ -133,23 +128,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Linux
if: runner.os == 'Linux'
- name: Set up apt dependencies
run: |
sudo apt update
sudo apt install -y rpm alien tmux
sudo apt remove -y jq
- name: Set up macOS (AMD64 and ARM64)
if: runner.os == 'macOS'
run: |
brew install --quiet coreutils tree autoconf automake libtool tmux sqlite3
brew uninstall jq
# --- Build ---

- name: Build on Linux (${{ env.AMD64_LINUX_GCC }})
if: runner.os == 'Linux'
env:
PREFIX: ${{ env.AMD64_LINUX_GCC }}
CC: gcc
Expand All @@ -161,7 +146,6 @@ jobs:
./scripts/ci-create-rpm-package.sh
- name: Build on Linux (${{ env.AMD64_LINUX_CLANG }})
if: runner.os == 'Linux'
env:
PREFIX: ${{ env.AMD64_LINUX_CLANG }}
CC: clang
Expand All @@ -172,26 +156,6 @@ jobs:
./scripts/ci-create-debian-package.sh
./scripts/ci-create-rpm-package.sh
- name: Build on macOS (${{ env.AMD64_MACOSX_GCC }})
if: matrix.os == 'macos-13'
env:
PREFIX: ${{ env.AMD64_MACOSX_GCC }}
CC: gcc-13
MAKE: make
RUN_TESTS: true
run: ./scripts/ci-build.sh

- name: Build on macOS (${{ env.ARM64_MACOSX_GCC }})
if: matrix.os == 'macos-14'
env:
PREFIX: ${{ env.ARM64_MACOSX_GCC }}
CC: gcc-13
MAKE: make
RUN_TESTS: true
run: ./scripts/ci-build.sh

# --- Upload build artifacts ---

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

Expand All @@ -206,7 +170,6 @@ jobs:
run: ./scripts/ci-verify-attestations.sh

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.zip)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.zip
Expand All @@ -217,7 +180,6 @@ jobs:
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.zip)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.zip
Expand All @@ -228,7 +190,6 @@ jobs:
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.deb)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.deb
Expand All @@ -239,7 +200,6 @@ jobs:
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.deb)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.deb
Expand All @@ -250,7 +210,6 @@ jobs:
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.rpm)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.rpm
Expand All @@ -261,7 +220,6 @@ jobs:
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.rpm)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.rpm
Expand All @@ -271,66 +229,105 @@ jobs:
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.zip)
if: matrix.os == 'macos-13'
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.tar.gz)
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.zip
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.zip)
if: matrix.os == 'macos-14'
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.tar.gz)
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.zip
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.tar.gz)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
- name: Upload release artifacts
if: startsWith(github.ref, 'refs/tags/v')
run: ./scripts/ci-upload-release-artifacts.sh

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

strategy:
matrix:
os: [macos-13, macos-14]

runs-on: ${{ matrix.os }}
timeout-minutes: 30

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

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

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

- name: Set up homebrew dependencies
run: brew install --quiet coreutils tree autoconf automake libtool tmux sqlite3

- name: Set PREFIX and ZIP env var
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
PREFIX: ${{ runner.arch == 'X64' && env.AMD64_MACOSX_GCC || env.ARM64_MACOSX_GCC }}
run: |
{
echo "PREFIX=$PREFIX"
echo "ZIP=zsv-$TAG-$PREFIX.zip"
echo "TAR=zsv-$TAG-$PREFIX.tar.gz"
} | tee -a "$GITHUB_ENV"
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.tar.gz)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
- name: Build on macOS (${{ env.AMD64_MACOSX_GCC }})
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.tar.gz
CC: gcc-13
MAKE: make
RUN_TESTS: true
run: ./scripts/ci-build.sh

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

- name: Codesign and notarize (${{ env.ZIP }})
if: startsWith(github.ref, 'refs/tags/v')
env:
MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
run: ./scripts/ci-macos-codesign-and-notarize.sh "$PWD/$ARTIFACT_DIR/$ZIP"

- name: Attest build artifacts for release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/attest-build-provenance@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
subject-path: ${{ env.ARTIFACT_DIR }}/*

- name: Verify attestations of release artifacts
if: startsWith(github.ref, 'refs/tags/v')
run: ./scripts/ci-verify-attestations.sh

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.tar.gz)
if: matrix.os == 'macos-13'
- name: Upload (${{ env.ZIP }})
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.tar.gz
ARTIFACT_NAME: ${{ env.ZIP }}
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.tar.gz)
if: matrix.os == 'macos-14'
- name: Upload (${{ env.TAR }})
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.tar.gz
ARTIFACT_NAME: ${{ env.TAR }}
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
Expand All @@ -341,12 +338,24 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
run: ./scripts/ci-upload-release-artifacts.sh

- name: Update homebrew tap (liquidaty/homebrew-zsv)
if: ${{ startsWith(github.ref, 'refs/tags/v') && matrix.os == 'macos-13' }}
update-homebrew-tap:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: ci-macos
runs-on: ubuntu-22.04

env:
TAG: ${{ needs.ci-macos.outputs.TAG }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
scripts/ci-update-homebrew-tap.sh
- name: Update
env:
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
TAG: ${{ env.TAG }}
TRIPLET: ${{ env.AMD64_MACOSX_GCC }}
run: ./scripts/ci-update-homebrew-tap.sh

ci-bsd:
Expand Down Expand Up @@ -533,7 +542,7 @@ jobs:
steps:
- name: Set up dependencies
shell: sh
run: apk add bash gcc make musl-dev perl ncurses-dev ncurses-static tmux file sqlite curl zip wget tar
run: apk add bash gcc make musl-dev perl ncurses-dev ncurses-static tmux file sqlite curl zip wget tar git

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -590,7 +599,9 @@ jobs:

- name: Upload release artifacts
if: startsWith(github.ref, 'refs/tags/v')
run: ./scripts/ci-upload-release-artifacts.sh
run: |
git config --global --add safe.directory "$PWD"
./scripts/ci-upload-release-artifacts.sh
ghcr:
needs: ci-musl
Expand Down Expand Up @@ -710,8 +721,8 @@ jobs:
with:
path: playground

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

Expand Down
24 changes: 19 additions & 5 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ CFLAGS+= -I${PREFIX}/include
THIS_LIB_BASE=$(shell cd .. && pwd)
INCLUDE_DIR=${THIS_LIB_BASE}/include
BUILD_DIR=${THIS_LIB_BASE}/build/${BUILD_SUBDIR}/${CCBN}
UTILS1=writer file err signal mem clock arg dl string dirs prop cache jq os overwrite index overwrite_writer
UTILS1=writer file err signal mem clock arg dl string dirs prop cache jq os index

ZSV_EXTRAS ?=

Expand All @@ -175,6 +175,11 @@ else # not emcc
CFLAGS+= ${CFLAGS_AVX} ${CFLAGS_SSE}
LDFLAGS+=-lpthread # Linux explicitly requires
endif

ifeq ($(ZSV_EXTRAS),1)
UTILS1+= overwrite overwrite_writer
endif

UTILS=$(addprefix ${BUILD_DIR}/objs/utils/,$(addsuffix .o,${UTILS1}))

ifeq ($(NO_THREADING),1)
Expand All @@ -195,8 +200,14 @@ endif

ZSV=$(BINDIR)/zsv${EXE}

SOURCES=echo paste count count-pull select select-pull 2tsv 2json serialize flatten pretty stack desc sql 2db compare prop rm mv jq overwrite
CLI_SOURCES=echo select desc count paste 2tsv pretty sql flatten 2json serialize stack 2db compare prop rm mv jq overwrite
SOURCES=echo paste count count-pull select select-pull 2tsv 2json serialize flatten pretty stack desc sql 2db compare prop rm mv jq
ifeq ($(ZSV_EXTRAS),1)
SOURCES+=overwrite
endif
CLI_SOURCES=echo select desc count paste 2tsv pretty sql flatten 2json serialize stack 2db compare prop rm mv jq
ifeq ($(ZSV_EXTRAS),1)
CLI_SOURCES+=overwrite
endif

ifeq ($(ZSVSHEET_BUILD),1)
SOURCES+=sheet
Expand Down Expand Up @@ -316,14 +327,13 @@ uninstall:
rm -rf ${ZSV}

ZSV_UTIL_A=${LIBDIR}/libzsvutil.a

${ZSV_UTIL_A}:SQLITE_EXT=
${ZSV_UTIL_A}:SQLITE_EXT_INCLUDE=
${ZSV_UTIL_A}: ${BUILD_DIR}/objs/utils/util.a
@mkdir -p `dirname $@`
cp -p $< $@

UTIL_A_OBJ:=index writer file dirs-no-jq os ${UTIL_A_OBJ_WIN}
UTIL_A_OBJ:=writer file dirs-no-jq os ${UTIL_A_OBJ_WIN}
UTIL_A_OBJ:=$(addprefix ${BUILD_DIR}/objs/utils/,$(addsuffix .o,${UTIL_A_OBJ}))

${BUILD_DIR}/objs/utils/util.a: ${UTIL_A_OBJ}
Expand Down Expand Up @@ -375,6 +385,10 @@ ${CLEANS}: clean-%:
.SUFFIXES:
.SUFFIXES: .o .c .a

${BUILD_DIR}/objs/utils/index.o: ${BUILD_DIR}/objs/utils/%.o : utils/%.c utils/%.h
@mkdir -p `dirname "$@"`
${CC} ${CFLAGS} -I${INCLUDE_DIR} -o $@ -c $<

${BUILD_DIR}/objs/utils/%.o : utils/%.c ${INCLUDE_DIR}/zsv/utils/%.h ${JQ_LIB}
@mkdir -p `dirname "$@"`
${CC} ${CFLAGS} -I${INCLUDE_DIR} -I${UTF8PROC_INCLUDE} -DINCLUDE_SRC -o $@ -c utils/$*.c ${MORE_SOURCE}
Expand Down
Loading

0 comments on commit 1a22213

Please sign in to comment.