-
Notifications
You must be signed in to change notification settings - Fork 4
131 lines (114 loc) · 3.84 KB
/
Copy pathci-native.yml
File metadata and controls
131 lines (114 loc) · 3.84 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
name: CI Native (GitHub Actions + Docker Buildx)
on:
push:
branches: [main, CI_migration]
tags:
- "*.*.*"
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CACHE_KEY: v1-${{ hashFiles('**/Cargo.lock') }}
concurrency:
group: ci-${{ github.ref }}
# cancel-in-progress: true
jobs:
setup:
runs-on: [self-hosted, linux, x64, repository, terraphim-ai, linux-self-hosted]
timeout-minutes: 15
outputs:
cache-key: ${{ steps.cache.outputs.key }}
ubuntu-versions: ${{ steps.ubuntu.outputs.versions }}
rust-targets: ${{ steps.targets.outputs.targets }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
clean: false
fetch-depth: 0
- name: Clean target directory
run: |
rm -rf target || true
mkdir -p target
- name: Generate cache key
id: cache
run: |
echo "key=$CACHE_KEY" >> $GITHUB_OUTPUT
- name: Set Ubuntu versions
id: ubuntu
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] || [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo 'versions=["18.04", "20.04", "22.04", "24.04"]' >> $GITHUB_OUTPUT
else
echo 'versions=["22.04"]' >> $GITHUB_OUTPUT
fi
- name: Set Rust targets
id: targets
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] || [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo 'targets=["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "x86_64-unknown-linux-musl"]' >> $GITHUB_OUTPUT
else
echo 'targets=["x86_64-unknown-linux-gnu"]' >> $GITHUB_OUTPUT
fi
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ needs.setup.outputs.cache-key }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ needs.setup.outputs.cache-key }}-cargo-lint-
- name: Run format and linting checks
run: ./scripts/ci-check-format.sh
lint-and-format:
runs-on: [self-hosted, linux, x64, repository, terraphim-ai, linux-self-hosted]
timeout-minutes: 15
needs: [setup]
steps:
- name: Clean workspace before checkout
shell: bash
run: |
sudo rm -rf target || true
sudo rm -rf .cargo || true
find . -name "*.lock" -type f -delete 2>/dev/null || true
- name: Checkout code
uses: actions/checkout@v6
with:
clean: false
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -yqq --no-install-recommends \
build-essential \
clang \
libclang-dev \
llvm-dev \
pkg-config \
libssl-dev \
libglib2.0-dev \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libsoup2.4-dev \
libjavascriptcoregtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.87.0
components: rustfmt, clippy
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ needs.setup.outputs.cache-key }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ needs.setup.outputs.cache-key }}-cargo-lint-
- name: Run format and linting checks
run: ./scripts/ci-check-format.sh