Skip to content

Commit a54713e

Browse files
authored
Enable COURSIER_BIN_DIR override & run tests on M1 (#382)
* Run tests on M1 * Fix cs bin directory on the M1 runner
1 parent 6fb8a29 commit a54713e

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ubuntu-latest, macOS-latest, windows-latest]
17+
os: [ubuntu-latest, macOS-latest, macOS-m1, windows-latest]
1818
jvm: ['temurin:17']
1919
steps:
2020
- uses: actions/checkout@v4
@@ -31,6 +31,8 @@ jobs:
3131
- run: echo 'name := "foo"' > build.sbt
3232
- id: scala-cli-setup
3333
uses: ./
34+
env:
35+
COURSIER_BIN_DIR: ${{ github.workspace }}/cs/bin
3436
with:
3537
jvm: ${{ matrix.jvm }}
3638
apps: sbt sbtn ammonite bloop:1.4.11

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ A GitHub Action to install Scala CLI.
2525
option, like publishing.
2626
- Defaults to `false`
2727

28+
### Environment variables
29+
- `JAVA_HOME`: path to the JVM to use
30+
- `COURSIER_BIN_DIR`: (optional) path to the directory where Coursier will install app binaries
31+
- defaults to `$HOME/cs/bin`
32+
- shouldn't have to be tampered with for vanilla GitHub action runners
33+
- make sure the directory is reachable for self-hosted runners
34+
- in case of issues, you can set it to something like
35+
```yaml
36+
env:
37+
COURSIER_BIN_DIR: ${{ github.workspace }}/cs/bin
38+
```
39+
2840
### Example with custom inputs
2941
3042
```yml

src/main.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,17 @@ async function run(): Promise<void> {
139139
}
140140
apps.push(`scala-cli${version ? `:${version}` : ''}`)
141141
if (value && apps.length) {
142-
const coursierBinDir = path.join(os.homedir(), 'cs', 'bin')
143-
core.exportVariable('COURSIER_BIN_DIR', coursierBinDir)
144-
core.addPath(coursierBinDir)
142+
if (process.env.COURSIER_BIN_DIR) {
143+
core.info(
144+
`Using the cs bin directory from COURSIER_BIN_DIR: ${process.env.COURSIER_BIN_DIR}`,
145+
)
146+
core.addPath(process.env.COURSIER_BIN_DIR)
147+
} else {
148+
const coursierBinDir = path.join(os.homedir(), 'cs', 'bin')
149+
core.info(`Setting COURSIER_BIN_DIR to: ${coursierBinDir}`)
150+
core.exportVariable('COURSIER_BIN_DIR', coursierBinDir)
151+
core.addPath(coursierBinDir)
152+
}
145153
await cs('install', '--contrib', ...apps)
146154
core.setOutput(
147155
'scala-cli-version',

0 commit comments

Comments
 (0)