Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.
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
9 changes: 2 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@ jobs:
- run: echo NAME=dune-${{ github.ref_name }}-${{ matrix.name }} >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- name: Build dune
run: nix build ${{ matrix.output }}
- name: Create dune tarball
run: |
cp -rL result $NAME
chmod -R u+w $NAME
tar czf $NAME.tar.gz $NAME
- name: Build the binary distro and package it as a tarball
- run: ./make_tarball.sh $NAME ${{ matrix.output }}
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
Expand Down
72 changes: 62 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,68 @@ name: test
on: [push, pull_request]
jobs:

shellcheck:
test-make-tarball:
name: "Test that we can build the binary distro and package it as a tarball"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-13
name: x86_64-apple-darwin
output: .#dune.dynamic
- os: macos-14
name: aarch64-apple-darwin
output: .#dune.dynamic
- os: ubuntu-latest
name: x86_64-unknown-linux-musl
output: .#dune.static
steps:
- run: echo NAME=dune-${{ matrix.name }} >> $GITHUB_ENV
- uses: actions/checkout@v4
- if: matrix.os == 'ubuntu-latest'
name: "Install shells on ubuntu"
run: |
sudo apt-get update
sudo apt-get install -y zsh fish
- if: matrix.os != 'ubuntu-latest'
name: "Install shells on macos"
run: brew install fish
- uses: cachix/install-nix-action@v31
- name: "Build the binary distro and package it as a tarball"
run: ./make_tarball.sh $NAME ${{ matrix.output }}
- name: "Extract the tarball"
run: tar xf $NAME.tar.gz
- name: "Test that we can env scripts and the dune executable is in the expected place"
run: |
bash -c '. $NAME/share/dune/env/env.bash; __dune_env $PWD/$NAME; test $(which dune) = $PWD/$NAME/bin/dune'
zsh -c '. $NAME/share/dune/env/env.zsh; __dune_env $PWD/$NAME; test $(which dune) = $PWD/$NAME/bin/dune'
fish -c '. $NAME/share/dune/env/env.fish; __dune_env $PWD/$NAME; test $(which dune) = $PWD/$NAME/bin/dune'
sh -c '. $NAME/share/dune/env/env.sh; __dune_env $PWD/$NAME; test $(which dune) = $PWD/$NAME/bin/dune'


test-make-tarball-shellcheck:
name: "Run shellcheck on the build script"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install shellcheck"
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: "Run shellcheck on the build script"
run: shellcheck make_tarball.sh


test-env-script-shellcheck:
name: "Run shellcheck on the shell env script"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install shellcheck"
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: "Run shellcheck on the shell env script"
run: |
# exclude warning for sourcing missing external file
shellcheck extra/share/dune/env/env.sh extra/share/dune/env/env.bash
- uses: actions/checkout@v4
- name: "Install shellcheck"
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: "Run shellcheck on the shell env script"
run: |
# exclude warning for sourcing missing external file
shellcheck extra/share/dune/env/env.sh extra/share/dune/env/env.bash
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
result
*.tar.gz
27 changes: 27 additions & 0 deletions make_tarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -eu

if [ "$#" -ne "2" ]; then
echo "Usage: $0 NAME TARGET"
echo
echo "Creates a file NAME.tar.gz containing the dune binary distro."
echo "TARGET is the nix target that gets built. It should be one of:"
echo " - .#dune.dynamic (builds a dynamically-linked dune executable)"
echo " - .#dune.static (builds a statically-linked dune executable)"
exit 1
Comment on lines +8 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own edification, where is the logic that will actually make this decision based on the value of TARGET? Searching this repo for those strings didn't seem to turn anything up for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in the github action in the file .github/workflows/build.yml.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes. That I saw. Perhaps that intended usage shoukd be noted here then? There is nothing about this script itself as is that lets readers of the file know it has a coupling like that with the GitHub workflow.

fi

NAME="$1"
TARGET="$2"

set -x

tmp_dir="$(mktemp -d)"
trap 'rm -rf "$tmp_dir"' EXIT
nix build "$TARGET"
cp -rL result "$tmp_dir/$NAME"
chmod -R u+w "$tmp_dir/$NAME"
pushd "$tmp_dir"
tar czf "$NAME.tar.gz" "$NAME"
popd
mv "$tmp_dir/$NAME.tar.gz" .