Skip to content

Commit

Permalink
Simplify CI and make it easy to get a standalone build
Browse files Browse the repository at this point in the history
The number of options that needed to be set to get a proper standalone
build is fairly large. Given that it was already repeated twice in
different CI contexts it occurred to me the whole batch of settings
should just be one preset so that people can build their own standalone
version easily from the source tarball if they want.
  • Loading branch information
alerque committed Jun 17, 2021
1 parent 37dd081 commit 6142deb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,12 @@ jobs:
run: |
echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
./bootstrap.sh
./configure \
--without-man-page \
--disable-tests \
--without-bash-completion-dir \
--without-zsh-completion-dir \
--program-suffix=-standalone.sh \
--with-deployment=standalone \
--bindir=/ \
COMM=comm GIT=git GREP=grep SED=sed SHELL=/bin/sh
make DESTDIR=. install-exec
./configure --with-standalone --bindir=/
make DESTDIR=. install-exec
- name: Upload standalone script artifact
uses: actions/upload-artifact@v2
with:
name: vcsh-standalone
name: standalone-deployment
path: vcsh-standalone.sh

ghrelase:
Expand Down Expand Up @@ -61,14 +53,14 @@ jobs:
- name: Download standalone script artifact
uses: actions/download-artifact@v2
with:
name: vcsh-standalone
name: standalone-deployment
- name: Publish Release
uses: softprops/action-gh-release@v1
with:
body_path: changelog-HEAD
files: |
vcsh-${{ env.VERSION }}.zip
vcsh-${{ env.VERSION }}.tar.xz
standalone/vcsh-standalone.sh
vcsh-standalone.sh
env:
GITHUB_TOKEN: ${{ github.token }}
12 changes: 2 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@ jobs:
- name: Configure standalone script
run: |
./bootstrap.sh
./configure
--without-man-page \
--disable-tests \
--without-bash-completion-dir \
--without-zsh-completion-dir \
--with-deployment=standalone \
--program-suffix=-standalone.sh \
--bindir=/ \
COMM=comm GIT=git GREP=grep SED=sed SHELL=/bin/sh
./configure --with-standalone --bindir=/
make DESTDIR=. install-exec
- name: Post standalone script artifact
uses: actions/upload-artifact@v2
with:
name: vcsh-standalone
name: standalone-deployment
path: vcsh-standalone.sh

test:
Expand Down
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ AC_DEFUN([AX_PROGVAR], [
test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required])
])

AC_ARG_WITH([standalone],
AS_HELP_STRING([--with-standalone],
[Use configuration presets for a standalone script deployment @<:@default=no@:>@]),
[COMM=comm GIT=git GREP=grep SED=sed SHELL=/bin/sh
with_deployment=standalone
with_man_page=no
enable_tests=no
with_bash_completion_dir=no
with_zsh_completion_dir=no
program_suffix=-standalone.sh
# By this point program_suffix has already been processed so we have to redo what configure did
# Code copied from approx L2670-2671
program_transform_name="s&\$&$program_suffix&;$program_transform_name"
program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"`
],
[])

AC_PROG_AWK
AC_PROG_GREP
AC_PROG_SED
Expand Down
7 changes: 4 additions & 3 deletions vcsh.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@


# If '.r<N>-g<SHA>' is appended to the version, you are seeing an unreleased
# version of vcsh; the main branch is supposed to be clean at all times
# so you can most likely just use it nonetheless
# version built from the main branch HEAD. If "-standalone" is appended you are
# using a version built explicitly for portability as a standalone script
# rather than being installed to a specific system.
VCSH_VERSION='@VERSION@@DEPLOYMENT@'; export VCSH_VERSION
VCSH_SELF="@TRANSFORMED_PACKAGE_NAME@"; export VCSH_SELF
VCSH_SELF='@TRANSFORMED_PACKAGE_NAME@'; export VCSH_SELF

# Ensure all files created are accessible only to the current user.
umask 0077
Expand Down

0 comments on commit 6142deb

Please sign in to comment.