This repository was archived by the owner on Jul 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
112 lines (100 loc) · 3.58 KB
/
main_pixlie_ai.yml
File metadata and controls
112 lines (100 loc) · 3.58 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
on:
push:
branches: ["main"]
tags:
- "v*"
paths:
- "pixlie_ai/**"
- ".github/workflows/main_pixlie_ai.yml"
pull_request:
branches: ["main"]
paths:
- "pixlie_ai/**"
- ".github/workflows/main_pixlie_ai.yml"
env:
CARGO_TERM_COLOR: always
concurrency:
# Avoid old jobs overlapping with new ones
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
main_pixlie_ai:
name: Pixlie AI
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: cli
asset_name: pixlie-linux-amd64-${{ github.ref_name }}
- os: macos-latest
artifact_name: cli
asset_name: pixlie-macos-arm64-${{ github.ref_name }}
- os: windows-latest
artifact_name: cli.exe
asset_name: pixlie-windows-amd64-${{ github.ref_name }}.exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Match with VERSION for tag pushes on Ubuntu/MacOS
if: startsWith(github.ref, 'refs/tags/v') && matrix.os != 'windows-latest'
run: |
VERSION=$(cat VERSION)
TAG_VERSION=${GITHUB_REF#refs/tags/v}
if [ "$TAG_VERSION" != "$VERSION" ]; then
echo "::error::Tag version $TAG_VERSION does not match VERSION file $VERSION"
exit 1
fi
- name: Match with VERSION for tag pushes on Windows
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'windows-latest'
run: |
$VERSION = Get-Content -Path "VERSION" -Raw
$TAG_VERSION = $env:GITHUB_REF -replace "refs/tags/v", ""
if ($TAG_VERSION -ne $VERSION.Trim()) {
Write-Output "::error::Tag version $TAG_VERSION does not match VERSION file $VERSION"
exit 1
}
shell: pwsh
- name: Pre-build installations for Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y clang libclang-dev
- name: Pre-build installations for MacOS
if: matrix.os == 'macos-latest'
uses: tecolicom/actions-use-homebrew-tools@v1
with:
tools: 'llvm rocksdb lld'
verbose: true
- name: Pre-build installations for Windows
if: matrix.os == 'windows-latest'
run: |
choco install llvm
- name: Set environment variables for MacOS
if: matrix.os == 'macos-latest'
run: .ci/set-macos-env.sh
shell: bash
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
workspaces: "pixlie_ai -> target"
- name: Test pixlie_ai
working-directory: "./pixlie_ai"
run: cargo test --verbose
- name: Build release
working-directory: "./pixlie_ai"
run: cargo build --release
- name: Add Executable permission
if: startsWith(github.ref, 'refs/tags/v') && (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest')
run: chmod +x pixlie_ai/target/release/${{ matrix.artifact_name }}
- name: Upload binaries to release
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pixlie_ai/target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}
# TODO: Temporary overwrite, remove once CI process is hardened
overwrite: true