Skip to content

Translate the rest of the open errnos into their NIO classes #702

Translate the rest of the open errnos into their NIO classes

Translate the rest of the open errnos into their NIO classes #702

Workflow file for this run

name: flake
on:
push:
pull_request:
permissions:
contents: read
jobs:
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- name: Linux x86_64
os: ubuntu-latest
system: x86_64-linux
- name: macOS arm64
os: macos-latest
system: aarch64-darwin
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v19
- name: Check the flake and formatting
run: |
nix flake check --no-build --no-write-lock-file
nix build .#formatter.${{ matrix.system }} --no-write-lock-file
./result/bin/nixfmt --check flake.nix
- name: Build and smoke-test the packaged Jolt
run: |
set -euo pipefail
nix build .#jolt --no-write-lock-file -L
out="$(nix path-info .#jolt --no-write-lock-file)"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp" result' EXIT
env -i HOME="$tmp/home" XDG_CACHE_HOME="$tmp/cache" PATH=/usr/bin:/bin \
"$out/bin/jolt" -e '(+ 40 2)' | grep -Fx '42'
# jolt.mvn-http's built-in macOS candidates are the Homebrew OpenSSL
# paths, and the runner image ships Homebrew OpenSSL — which would let
# the fetch below pass without the Nix-provided OpenSSL ever loading.
# Remove the Homebrew entries so success can only come through the
# wrapper's JOLT_OPENSSL_LIBDIR.
- name: Drop Homebrew OpenSSL from the built-in candidate paths (macOS)
if: runner.os == 'macOS'
run: |
sudo rm -f /opt/homebrew/opt/openssl@3 \
/opt/homebrew/lib/libcrypto.dylib /opt/homebrew/lib/libssl.dylib
sudo rm -rf /usr/local/opt/openssl@3
- name: Verify packaged dependency resolution
run: |
set -euo pipefail
out="$(nix path-info .#jolt --no-write-lock-file)"
nix-store -q --references "$out" | grep -q -- '-nss-cacert-'
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp" result' EXIT
cert="$(env -i HOME="$tmp/home" XDG_CACHE_HOME="$tmp/cache" PATH=/usr/bin:/bin \
"$out/bin/jolt" -e '(System/getenv "SSL_CERT_FILE")' | tr -d '"')"
test -r "$cert"
# The Maven dependency makes the resolver download and unzip a jar.
# The local Git dependency drives jolt.deps through its git shell-out
# without adding another network dependency to this CI check.
gitdep="$tmp/gitdep"
mkdir -p "$gitdep/src/gitdep"
cat > "$gitdep/deps.edn" <<'EOF'
{:paths ["src"]}
EOF
cat > "$gitdep/src/gitdep/core.clj" <<'EOF'
(ns gitdep.core)
(def answer 39)
EOF
git -C "$gitdep" init --quiet
git -C "$gitdep" add .
git -C "$gitdep" -c user.name=flake-ci -c user.email=flake-ci@example.invalid \
commit --quiet -m initial
sha="$(git -C "$gitdep" rev-parse HEAD)"
app="$tmp/app"
mkdir -p "$app/src/app"
cat > "$app/deps.edn" <<EOF
{:paths ["src"]
:deps {org.clojure/math.combinatorics {:mvn/version "0.2.0"}
test/gitdep {:git/url "file://$gitdep"
:git/sha "$sha"}}}
EOF
cat > "$app/src/app/core.clj" <<'EOF'
(ns app.core
(:require [clojure.math.combinatorics :as combo]
[gitdep.core :as gitdep]))
(defn -main []
(println (+ gitdep/answer (count (combo/combinations [1 2 3] 2)))))
EOF
(
cd "$app"
env -i HOME="$tmp/home" XDG_CACHE_HOME="$tmp/cache" \
JOLT_MAVEN_REPOSITORY="$tmp/m2" JOLT_GITLIBS_DIR="$tmp/gitlibs" \
PATH=/usr/bin:/bin "$out/bin/jolt" run -m app.core
) | grep -Fx '42'
- name: Verify the development shell does not bootstrap Makes from Git
run: |
nix develop --ignore-environment --command bash -seu <<'SH'
test -f "$M/init.mk"
test ! -e "$M/.git"
shim="$(mktemp -d)"
trap 'rm -rf "$shim"' EXIT
export REAL_GIT="$(command -v git)"
cat > "$shim/git" <<'GIT'
#!/usr/bin/env bash
# Git accepts options before its subcommand (for example,
# `git -C DIR fetch`), so inspect every argument rather than $1.
for arg; do
case "$arg" in
clone|fetch)
echo "unexpected Make bootstrap: git $*" >&2
exit 99
;;
esac
done
exec "$REAL_GIT" "$@"
GIT
chmod +x "$shim/git"
PATH="$shim:$PATH" make shelloutcheck
PATH="$shim:$PATH" make makefilesmoke
SH