-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.32 KB
/
Copy pathci.yml
File metadata and controls
87 lines (73 loc) · 2.32 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
name: Verify & Release
on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:
branches: ["main"]
env:
BUILD_TYPE: Release
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Deps
run: sudo apt-get update && sudo apt-get install -y libreadline8 libreadline-dev lcov
- name: Generate Version C File
run: ./scripts/generate_version_c.sh ./build/generated/version.c VERSION.txt
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test (With Coverage)
run: ./scripts/coverage.sh
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: clox
path: ./build/clox
if-no-files-found: error
overwrite: true
- name: Upload coverage file
uses: actions/upload-artifact@v4
with:
name: lcov.info
path: ./lcov.info
if-no-files-found: error
overwrite: true
- name: Upload coverage HTML report
uses: actions/upload-artifact@v4
with:
name: lcov.html
path: ./build/coverage_html
if-no-files-found: error
overwrite: true
release:
needs: verify
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write # needed to create a release
steps:
- name: Checkout repository (including tags)
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch tags for changelog
- name: Download binary artifact from verify job
uses: actions/download-artifact@v4
with:
name: clox
path: ./release
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
RELEASE_NAME="Release ${TAG}"
# Grab the most recent commit message for the release notes (optional)
NOTES="$(git log -1 --pretty=%B ${TAG})"
gh release create "${TAG}" \
--title "${RELEASE_NAME}" \
--notes "${NOTES}" \
./release/clox