Skip to content

fix: use CLJ_CONFIG for Maven local repo in GraalVM native image #12

fix: use CLJ_CONFIG for Maven local repo in GraalVM native image

fix: use CLJ_CONFIG for Maven local repo in GraalVM native image #12

name: "Copilot Setup Steps"
# This workflow configures the environment for GitHub Copilot Agent with gh-aw MCP server
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called 'copilot-setup-steps' to be recognized by GitHub Copilot Agent
copilot-setup-steps:
runs-on: ubuntu-latest
# Set minimal permissions for setup steps
# Copilot Agent receives its own token with appropriate permissions
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Set up Clojure
uses: DeLaGuardo/setup-clojure@13.5.2
with:
cli: 1.12.4.1582
bb: 1.12.214
- name: Cache Clojure deps
uses: actions/cache@v5
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
.cpcache
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
restore-keys: cljdeps-
- name: Symlink tools to standard PATH
run: |
sudo ln -sf $(which bb) /usr/local/bin/bb
sudo ln -sf $(which clj) /usr/local/bin/clj
sudo ln -sf $(which clojure) /usr/local/bin/clojure
sudo ln -sf $(which java) /usr/local/bin/java
- name: Pre-download Clojure deps and ensure global access
run: |
# Download Maven deps via system clojure
clojure -P
# Also resolve bb.edn deps (org.clojure/clojure)
bb clojure -P
# Copy the tools jar to ~/.deps.clj/ so bb can find it.
# bb's deps.clj delegates to system clojure when it's on PATH,
# so bb clojure -P never writes the jar to ~/.deps.clj/.
CLJ_VER=$(clojure --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1)
INSTALL_DIR="${CLOJURE_INSTALL_DIR:-}"
if [ -z "$INSTALL_DIR" ]; then
INSTALL_DIR=$(grep '^install_dir=' "$(which clojure)" 2>/dev/null | cut -d= -f2-)
fi
if [ -n "$CLJ_VER" ] && [ -n "$INSTALL_DIR" ]; then
TOOLS_TARGET="$HOME/.deps.clj/$CLJ_VER/ClojureTools"
SRC_JAR=$(find "$INSTALL_DIR" -name "clojure-tools-$CLJ_VER.jar" -print -quit 2>/dev/null)
if [ -n "$SRC_JAR" ] && [ ! -f "$TOOLS_TARGET/clojure-tools-$CLJ_VER.jar" ]; then
mkdir -p "$TOOLS_TARGET"
cp "$SRC_JAR" "$TOOLS_TARGET/"
echo "Copied tools jar to $TOOLS_TARGET"
fi
fi
# Inside the awf sandbox $HOME is /root, but the mounts map
# /home/runner/.deps.clj and /home/runner/.m2 into the container
# at those same absolute paths. bb is a GraalVM native image so
# JAVA_TOOL_OPTIONS has no effect — we must use env vars that
# bb/tools.deps read directly.
#
# DEPS_CLJ_TOOLS_DIR: tells bb's deps.clj where the tools jar is
# CLJ_CONFIG: tells tools.deps where to find user deps.edn (which
# contains :mvn/local-repo pointing to the mounted Maven cache)
echo '{:mvn/local-repo "/home/runner/.m2/repository"}' > "$HOME/.deps.clj/deps.edn"
echo "DEPS_CLJ_TOOLS_DIR=$HOME/.deps.clj" >> "$GITHUB_ENV"
echo "CLJ_CONFIG=$HOME/.deps.clj" >> "$GITHUB_ENV"
# Ensure deps directories are readable by any user
chmod -R a+rX ~/.m2/repository ~/.deps.clj 2>/dev/null || true
- name: Install gh-aw extension
uses: github/gh-aw/actions/setup-cli@v0.46.0
with:
version: v0.46.0