-
Notifications
You must be signed in to change notification settings - Fork 24
161 lines (133 loc) · 4.25 KB
/
release.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Release
on:
push:
tags:
- "*.*.*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tests-conan:
uses: ./.github/workflows/test_conan.yml
check-dockerfile:
uses: ./.github/workflows/check_dockerfile.yml
build-conan:
needs: tests-conan
strategy:
fail-fast: true
matrix:
config:
- { os: ubuntu-22.04, cc: "gcc", cxx: "g++" }
- { os: macos-14, cc: "clang", cxx: "clang++" }
runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore ccache caches
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}
- name: Conan cache
uses: actions/cache@v4
with:
path: ~/.conan/data
key: conan-${{ runner.os }}-${{ hashFiles('**/conanfile.py') }}
- name: apt cache
uses: actions/cache@v4
if: runner.os == 'Linux'
with:
path: |
/var/cache/apt/
/var/lib/apt/
key: apt-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/install_deps_ubuntu.sh') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Set up pipx
run: |
python -m pip install --user pipx
python -m pipx ensurepath
- name: Set up Conan
run: |
pipx install cmake
pipx install conan
- name: Install compilers (Ubuntu)
if: runner.os == 'Linux'
run: sudo apt install build-essential ninja-build ccache
- name: Install compilers (macOS)
if: runner.os == 'macOS'
run: brew install cmake ninja ccache
- name: Build sc-machine
id: run_cmake
run: |
cmake --preset release-conan
cmake --build --preset release
- name: Set Conan remote
run: |
conan remote add ostis-ai https://conan.ostis.net/artifactory/api/conan/ostis-ai-sc-machine/
conan remote login ostis-ai ${{ secrets.CONAN_USERNAME }} -p ${{ secrets.CONAN_API_KEY }}
- name: Create Conan package
run: |
conan install . --build=missing
conan export-pkg .
- name: Upload to Conan remote
run: |
conan upload sc-machine/${{ github.ref_name }} -r ostis-ai
- name: Create archive
run: |
cd ./build/Release
cpack -G TGZ
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: sc-machine-${{ matrix.config.os }}-${{ github.ref_name }}
path: ./build/Release/sc-machine-*.tar.gz
changelog:
needs: build-conan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read changelog
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ github.ref_name }}
path: docs/changelog.md
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: sc-machine-*
path: artifacts
- name: Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog_reader.outputs.changes }}
name: 'v${{ github.ref_name }}'
files: |
artifacts/**/*.tar.gz
docker:
needs: check-dockerfile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ostis/sc-machine:latest,ostis/sc-machine:${{ github.ref_name }}
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=ostis/sc-machine:buildcache
cache-to: type=registry,ref=ostis/sc-machine:buildcache,mode=max