-
Notifications
You must be signed in to change notification settings - Fork 6
56 lines (47 loc) · 1.26 KB
/
build_and_test.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
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
schedule:
# At 03:45 on Friday. (Thanks, crontab.guru)
- cron: '45 3 * * 5'
name: Build and test
jobs:
build_test:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Run build
run: cargo build --all-targets
- name: Run tests
run: cargo test
- name: Check formatting
run: cargo fmt --check
- name: Run Clippy
run: cargo clippy --all-targets
- name: Run examples
if: ${{ github.event_name != 'pull_request'}}
env:
HCLOUD_API_TOKEN: ${{ secrets.HCLOUD_API_TOKEN }}
run: |
set -e
cargo run --example find_cheapest_server_type "$HCLOUD_API_TOKEN"
cargo run --example list_images "$HCLOUD_API_TOKEN"
cargo run --example list_isos "$HCLOUD_API_TOKEN"
cargo run --example list_servers "$HCLOUD_API_TOKEN"