Example of using earthly CI (Earthfile) to build Terraphim Axum server with cross-platform #2
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
name: CI | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "*.*.*" | |
pull_request: | |
types: [opened, synchronize] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }} | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
FORCE_COLOR: 1 | |
steps: | |
- uses: earthly/actions-setup@v1 | |
with: | |
version: v0.7.23 | |
- uses: actions/checkout@v2 | |
- name: Docker Login | |
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN" | |
- name: Run build | |
run: earthly --org applied-knowledge-systems --sat my-satellite --ci --push +docker_all | |
build-and-test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libsoup2.4-dev libwebkit2gtk-4.0-dev | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: cargo check | |
run: cargo check --workspace --exclude terraphim_ai --exclude app | |
# TODO: Enable once formatting is fixed | |
# - name: cargo fmt | |
# run: cargo fmt --all -- --check | |
- name: cargo clippy | |
run: cargo clippy --workspace --exclude terraphim_ai --exclude app --all-targets --all-features -- -D warnings | |
- name: cargo test | |
run: cargo test --workspace --exclude terraphim_ai --exclude app --all-targets --all-features |