-
Notifications
You must be signed in to change notification settings - Fork 4
136 lines (108 loc) · 3.18 KB
/
ci.yml
File metadata and controls
136 lines (108 loc) · 3.18 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
crystal: [latest]
name: Test on ${{ matrix.os }} with Crystal ${{ matrix.crystal }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Cache shards
uses: actions/cache@v4
with:
path: |
~/.cache/shards
./lib
key: ${{ runner.os }}-shards-${{ hashFiles('shard.lock') }}
restore-keys: |
${{ runner.os }}-shards-
- name: Install dependencies
run: shards install
- name: Check code formatting
run: crystal tool format --check src spec
- name: Run code climate checks
run: ./bin/ameba src/amber_cli/native src/amber_lsp
continue-on-error: true
- name: Compile CLI
run: crystal build src/amber_cli.cr --no-debug -o amber
- name: Compile LSP
run: crystal build src/amber_lsp.cr --no-debug -o amber-lsp
- name: Build LSP binary for integration specs
run: |
mkdir -p bin
crystal build src/amber_lsp.cr --no-debug -o bin/amber-lsp
- name: Run tests
run: crystal spec
- name: Build release binaries
if: matrix.os == 'ubuntu-latest'
run: |
crystal build src/amber_cli.cr --release --no-debug -o amber_cli
crystal build src/amber_lsp.cr --release --no-debug -o amber_lsp
- name: Upload binary artifacts (Linux)
uses: actions/upload-artifact@v7
if: matrix.os == 'ubuntu-latest'
with:
name: amber-cli-linux
path: |
amber_cli
amber_lsp
# Separate job for additional platform-specific tests
platform-specific:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
name: Platform-specific tests on ${{ matrix.os }}
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: latest
- name: Install dependencies
run: shards install
- name: Test CLI functionality
run: |
crystal build src/amber_cli.cr -o amber_cli
./amber_cli --help || true
./amber_cli --version || true
- name: Test LSP functionality
run: |
crystal build src/amber_lsp.cr -o amber_lsp
test -x ./amber_lsp
# Job to run integration tests
integration:
runs-on: ubuntu-latest
name: Integration tests
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: latest
- name: Install dependencies
run: shards install
- name: Run integration tests
run: |
if [ -d "spec/integration" ]; then
crystal spec spec/integration/
else
echo "No integration tests found, skipping..."
fi