Skip to content

Commit

Permalink
wip: gha test
Browse files Browse the repository at this point in the history
  • Loading branch information
pshirshov committed Oct 25, 2024
1 parent 32dfb70 commit 7c4638b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 29 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/baboon-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ jobs:
if: matrix.preconfigured != true
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build
run: |
./nix-rebuild.sh
run: ./build.sh nix build test
- uses: actions/upload-artifact@v4
with:
name: baboon-${{ matrix.target }}
Expand Down Expand Up @@ -80,7 +79,7 @@ jobs:
native-image-job-reports: true
- name: Build (windows)
shell: bash
run: bash ./local-rebuild.sh
run: ./build.sh build test
- uses: actions/upload-artifact@v4
with:
name: baboon-${{ matrix.target }}
Expand All @@ -101,8 +100,7 @@ jobs:
path: binaries
pattern: baboon-*
- name: Prepare layout
run: |
bash prepare-dist.sh ./binaries
run: bash prepare-dist.sh . ./binaries
- uses: softprops/action-gh-release@v2
id: create-release
if: startsWith(github.ref, 'refs/tags/')
Expand Down
32 changes: 32 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e

(for e in "$@"; do [[ "$e" == "nix" ]] && exit 0; done) && NIXIFY=1 || NIXIFY=0

if [[ $NIXIFY == 1 && ! -v IN_NIX_SHELL ]]; then
echo "Restarting in Nix..."
self=$(realpath -s "$0")
set -x
nix flake lock
nix flake metadata
exec nix develop --command bash $self "$@"
fi

set -x
cd "$(dirname $(readlink -f "$0"))"

for i in "$@"
do
case $i in
nix) ;;

build) ./devops/local-build.sh ;;
test) ./devops/local-test.sh ;;

*)
echo "Unknown option: $i"
exit 1
;;
esac
done
2 changes: 1 addition & 1 deletion local-build.sh → devops/local-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -x
set -e
set -x

sbt GraalVMNativeImage/packageBin
2 changes: 1 addition & 1 deletion local-test.sh → devops/local-test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -x
set -e
set -x

pushd .

Expand Down
14 changes: 8 additions & 6 deletions prepare-dist.sh → devops/prepare-dist.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/env bash

set -x
set -e

set -x

src=$1
tgt=$2

mkdir -p dist-bin
mkdir -p dist-zip
distbin="$tgt/dist-bin"
distzip="$tgt/dist-zip"

distbin="$(pwd)/dist-bin"
distzip="$(pwd)/dist-zip"
mkdir -p $distbin
mkdir -p $distzip

pushd .

Expand All @@ -28,3 +28,5 @@ do
false
fi
done

popd
7 changes: 0 additions & 7 deletions local-rebuild.sh

This file was deleted.

9 changes: 0 additions & 9 deletions nix-rebuild.sh

This file was deleted.

0 comments on commit 7c4638b

Please sign in to comment.