-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (77 loc) · 2.35 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
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
name: CI/CD Workflow
on:
push:
branches:
- main
- feat-*
pull_request:
branches:
- main
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
# Step 1. Checkout the Repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2. Install Protocol Buffers Compiler (protoc)
- name: Install Protobuf Compiler (protoc)
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
protoc --version # Print protoc version to confirm installation
# Step 3. Install Rust (via rustup)
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy # Install supplementary tools
override: true
# Step 4. Install Cargo Dependencies
- name: Install dependencies
run: |
cargo fetch
# Step 5. Build the Project
- name: Build the project
run: |
cargo build --verbose --workspace
# Step 6. Run Tests
- name: Run tests
run: |
cargo test --verbose --workspace
# Step 6. Run Build for Dioxus Web App (if applicable)
# - name: Build Dioxus frontend (WebAssembly)
# if: exists('./clickplanet-webapp/Dioxus.toml')
# run: |
# cd clickplanet-webapp
# dioxus build --release
# Step 7. Lint and Format (Optional)
# - name: Run Clippy (Lint)
# run: |
# cargo clippy --workspace --all-targets --all-features -- -D warnings
# - name: Check formatting
# run: |
# cargo fmt --all -- --check
docker:
name: Build Docker Images
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build Docker Images
run: |
docker compose -f docker-compose.yml build
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker images
run: |
docker compose -f docker-compose.yml push