-
Notifications
You must be signed in to change notification settings - Fork 17
116 lines (95 loc) · 3.2 KB
/
ci.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: ci
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.13.2
- name: Install dependencies
run: shards install
- name: Install coverage.py
run: "pip install --upgrade pip && pip install coverage && pip install pytest"
- name: Run tests
run: crystal spec --verbose --order random --error-on-warnings
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.13.2
- name: Install dependencies
run: shards install
- name: Run linter
run: bin/ameba
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.13.2
- run: make build
- name: Install kcov
run: |
sudo apt-get update
sudo apt-get install kcov
- name: Install coverage.py
run: "pip install --upgrade pip && pip install coverage && pip install pytest"
- name: Generate coverage
run: bin/crkcov --kcov-args --exclude-pattern=/usr/include,/usr/lib,lib/,spec/ --coverage-dir ${{ github.workspace }}/coverage
- name: Capture and export coverage report file as variable
run: |
COVERAGE_FILE=$(find ${{ github.workspace }}/coverage -name "*.xml" | grep cobertura.xml)
echo "COVERAGE_FILE=$COVERAGE_FILE" >> $GITHUB_ENV
- name: Report coverage
env:
COVERALLS_REPO_TOKEN: ${{ github.token }}
run: |
cd coverage
../bin/coveralls report --measure --base-path src/coverage_reporter/
- name: List contents of coverage/ directory
run: ls -la coverage/
- name: List contents of coverage/ directory
run: ls -la ${{ github.workspace }}/coverage/
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ${{ env.COVERAGE_FILE }}
retention-days: 5
- name: Create coverage summary
run: |
echo "Coverage Summary" > coverage_summary.txt
echo "Date: $(date)" >> coverage_summary.txt
echo "Commit: ${{ github.sha }}" >> coverage_summary.txt
# Add more relevant info from your coverage report
- name: Upload coverage summary
uses: actions/upload-artifact@v4
with:
name: coverage-summary
path: coverage_summary.txt
retention-days: 5
- name: List uploaded artifacts
run: ls -la coverage/
- name: Debug uploaded artifact
run: |
echo "Artifact URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/"
- name: Display Workflow ID
run: |
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows" \
| jq '.workflows[] | select(.name == "ci") | .id'