-
Notifications
You must be signed in to change notification settings - Fork 36
109 lines (105 loc) · 3.34 KB
/
cargo-test.yaml
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
name: Cargo lint and test
on:
push:
branches: ["main"]
paths-ignore:
- 'tembo-py/**'
pull_request:
branches: ["main"]
paths-ignore:
- 'tembo-py/**'
jobs:
find_directories:
name: Find changed Cargo projects
runs-on: ubuntu-20.04
outputs:
directories: ${{ steps.find_directories.outputs.build_matrix }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Find directories with Dockerfiles that changed
id: find_directories
uses: ./.github/actions/find-changed-directories
with:
contains_the_file: Cargo.toml
changed_relative_to_ref: origin/${{ github.base_ref || 'not-a-branch' }}
ignore_dirs: ".coredb examples tembo-cli/temboclient tembo-cli/tembodataclient"
lint:
name: Run linters
runs-on:
- self-hosted
- dind
- small
needs:
- find_directories
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }}
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
set -xe
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
- name: Install minimal nightly with clippy and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Install minimal stable with clippy and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "${{ matrix.name }}-lint"
workspaces: |
${{ matrix.path }}
- name: Cargo format and clippy
run: |
set -xe
cd ${{ matrix.path }}
cargo --version
cargo fmt --all --check
cargo clippy
test:
name: Run tests
runs-on:
- self-hosted
- dind
- large-8x8
needs:
- find_directories
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install system dependencies
run: |
set -xe
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev lsb-release
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
sudo apt-get update && sudo apt-get install -y postgresql-client
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "${{ matrix.name }}-test"
workspaces: |
${{ matrix.path }}
- name: Unit tests
run: |
set -xe
export PROMETHEUS_URL=https://prometheus-data-1.use1.dev.plat.cdb-svc.com
cd ${{ matrix.path }} && cargo test
env:
ORG_ID: org_2YW4TYIMI1LeOqJTXIyvkHOHCUo
ACCESS_TOKEN: ${{ secrets.TEMBO_TOKEN_TEST_ORG_DEV }}
TEMBO_HOST: ${{ secrets.TEMBO_HOST }}
TEMBO_DATA_HOST: ${{ secrets.TEMBO_DATA_HOST }}