-
Notifications
You must be signed in to change notification settings - Fork 4
139 lines (111 loc) · 3.27 KB
/
ci.yml
File metadata and controls
139 lines (111 loc) · 3.27 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
137
138
139
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]
include:
- os: ubuntu-latest
crystal-install: |
curl -fsSL https://crystal-lang.org/install.sh | sudo bash
- os: macos-latest
crystal-install: |
brew install crystal
name: Test on ${{ matrix.os }} with Crystal ${{ matrix.crystal }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Crystal (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
curl -fsSL https://crystal-lang.org/install.sh | sudo bash
crystal version
- name: Install Crystal (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install crystal
crystal version
- name: Cache shards
uses: actions/cache@v5
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
continue-on-error: true
- name: Run ameba linter
run: ./bin/ameba
continue-on-error: true
- name: Compile project
run: crystal build src/amber_cli.cr --no-debug
- name: Run tests
run: crystal spec
- name: Build release binary
run: crystal build src/amber_cli.cr --release --no-debug -o amber_cli
if: matrix.os == 'ubuntu-latest'
- name: Upload binary artifact (Linux)
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: amber_cli-linux
path: amber_cli
# 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@v4
- name: Install Crystal (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
curl -fsSL https://crystal-lang.org/install.sh | sudo bash
- name: Install Crystal (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install crystal
- 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
# Job to run integration tests
integration:
runs-on: ubuntu-latest
name: Integration tests
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Crystal
run: |
curl -fsSL https://crystal-lang.org/install.sh | sudo bash
- 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