Skip to content

Commit fe9a235

Browse files
Fix CI (#669)
1 parent 91b41a4 commit fe9a235

File tree

12 files changed

+697
-712
lines changed

12 files changed

+697
-712
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ jobs:
2828
- uses: ./
2929
with:
3030
root: test
31-
extraFiles: test/foo.sh # for the ammonite-runner version
31+
extraFiles: test/foo.sh # for the ammonite version?
3232

33-
- run: cd test && ./sbt compile && ./foo.sh
33+
- run: cd test && eval "$(./cs java --env --jvm 17)" && ./mill -i __.compile && ./foo.sh
34+
if: runner.os != 'Windows'
35+
shell: bash
36+
37+
- run: cd test && eval "$(./cs java --env --jvm 17)" && cmd /c "mill.bat -i __.compile" && ./foo.sh
38+
if: runner.os == 'Windows'
3439
shell: bash

test/.mill-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.12.10

test/build.sbt

Lines changed: 0 additions & 2 deletions
This file was deleted.

test/build.sc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import mill._
2+
import mill.scalalib._
3+
4+
object thing extends ScalaModule {
5+
def scalaVersion = "2.13.5"
6+
def ivyDeps = Agg(ivy"com.github.alexarchambault::case-app-cats:2.0.4")
7+
}

test/coursier

-41.6 KB
Binary file not shown.

test/cs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
3+
# cs launcher script
4+
# This script lives at https://github.com/coursier/ci-scripts/blob/master/cs.sh
5+
# (Raw version for curl: https://github.com/coursier/ci-scripts/raw/master/cs.sh)
6+
7+
# Originally adapted from https://github.com/VirtusLab/scala-cli/blob/b754d2afdda114e97febfb0090773cc582bafd19/scala-cli.sh
8+
9+
set -eu
10+
11+
CS_VERSION="2.1.25-M4"
12+
13+
GH_ORG="coursier"
14+
GH_NAME="coursier"
15+
16+
TAG="v$CS_VERSION"
17+
18+
IS_WINDOWS=false
19+
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" == "MINGW" ]; then
20+
IS_WINDOWS=true
21+
fi
22+
23+
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" == "Linux" ]; then
24+
arch="$(uname -m)"
25+
if [ "$arch" == "aarch64" ] || [ "$arch" == "x86_64" ]; then
26+
CS_URL="https://github.com/$GH_ORG/$GH_NAME/releases/download/$TAG/cs-$arch-pc-linux.gz"
27+
CACHE_BASE="$HOME/.cache/coursier/v1"
28+
else
29+
echo "No native coursier launcher available for architecture $arch on Linux" 1>&2
30+
exit 1
31+
fi
32+
elif [ "$(uname)" == "Darwin" ]; then
33+
arch="$(uname -m)"
34+
CACHE_BASE="$HOME/Library/Caches/Coursier/v1"
35+
if [ "$arch" == "x86_64" ]; then
36+
CS_URL="https://github.com/$GH_ORG/$GH_NAME/releases/download/$TAG/cs-x86_64-apple-darwin.gz"
37+
elif [[ "$arch" == "arm64" ]]; then
38+
CS_URL="https://github.com/$GH_ORG/$GH_NAME/releases/download/$TAG/cs-aarch64-apple-darwin.gz"
39+
else
40+
echo "No native coursier launcher available for architecture $arch on macOS" 1>&2
41+
exit 1
42+
fi
43+
elif [ "$IS_WINDOWS" == true ]; then
44+
CS_URL="https://github.com/$GH_ORG/$GH_NAME/releases/download/$TAG/cs-x86_64-pc-win32.zip"
45+
CACHE_BASE="$LOCALAPPDATA/Coursier/cache/v1"
46+
else
47+
echo "This standalone cs launcher supports only Linux and macOS." 1>&2
48+
exit 1
49+
fi
50+
51+
CACHE_DEST="$CACHE_BASE/$(echo "$CS_URL" | sed 's@://@/@')"
52+
53+
if [ "$IS_WINDOWS" == true ]; then
54+
CS_BIN_PATH="${CACHE_DEST%.zip}.exe"
55+
else
56+
CS_BIN_PATH=${CACHE_DEST%.gz}
57+
fi
58+
59+
if [ ! -f "$CACHE_DEST" ]; then
60+
mkdir -p "$(dirname "$CACHE_DEST")"
61+
TMP_DEST="$CACHE_DEST.tmp-setup"
62+
echo "Downloading $CS_URL" 1>&2
63+
curl -fLo "$TMP_DEST" "$CS_URL"
64+
mv "$TMP_DEST" "$CACHE_DEST"
65+
fi
66+
67+
if [ ! -f "$CS_BIN_PATH" ]; then
68+
if [ "$IS_WINDOWS" == true ]; then
69+
unzip -p "$CACHE_DEST" cs-x86_64-pc-win32.exe > "$CS_BIN_PATH"
70+
else
71+
gunzip -k "$CACHE_DEST"
72+
fi
73+
fi
74+
75+
if [ "$IS_WINDOWS" != true ]; then
76+
if [ ! -x "$CS_BIN_PATH" ]; then
77+
chmod +x "$CS_BIN_PATH"
78+
fi
79+
fi
80+
81+
exec "$CS_BIN_PATH" "$@"

test/foo.sc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// scala 2.13.3, ammonite 2.2.0-1-56b4d41
2-
31
import $ivy.`com.chuusai::shapeless:2.3.3`
42

53
import shapeless._

test/foo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
set -e
33

44
cd "$(dirname "${BASH_SOURCE[0]}")"
5-
exec ./coursier launch --contrib amm-runner:0.3.2 --scala 2.13.5 -- ./foo.sc
5+
exec ./cs launch ammonite:2.2.0-1-56b4d41 --scala 2.13.3 --jvm 17 -- ./foo.sc

0 commit comments

Comments
 (0)