Build and test #149
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |