generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 7
97 lines (90 loc) · 2.49 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: 'build-test'
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- 'releases/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
yarn
- run: |
yarn run all
- run: |
git diff --name-only --exit-code
- run: |
node dist/index.js
if ! [ -x "$(command -v kotlinc)" ]; then
echo 'Error: Expected kotlinc to be installed.' >&2
exit 1
fi
env:
INPUT_VERSION: 2.0.21
INPUT_INSTALL-NATIVE: false
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./
test-with-arg:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
version: 2.0.21
script: |
#!/usr/bin/env kotlin
fun getInput(name: String): String {
return System.getenv("INPUT_${name.replace(" ", "_").toUpperCase()}")
}
if (getInput("version") != "2.0.21") {
throw RuntimeException("Expected version 2.0.21")
}
test-with-arg-default-version:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
script: |
#!/usr/bin/env kotlin
fun getInput(name: String): String {
return System.getenv("INPUT_${name.replace(" ", "_").toUpperCase()}")
}
if (getInput("version") != "2.0.21") {
throw RuntimeException("Expected version 2.0.21")
}
test-with-native:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
version: 2.0.21
install-native: true
- run: kotlinc -version
- run: kotlinc-native -version
- run: echo 'fun main() {println("Hello Kotlin/Native!")}' > hello.kt
- run: kotlinc-native hello.kt
- run: ./program.exe
if: ${{ matrix.os == 'windows-latest' }}
- run: ./program.kexe
if: ${{ matrix.os != 'windows-latest' }}