Skip to content

Commit a179f6d

Browse files
authored
Merge pull request #5 from alegeay/dev
Remove target in history
2 parents 49b1366 + f9af0be commit a179f6d

12 files changed

Lines changed: 862 additions & 2361 deletions

File tree

‎.env‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎.env.example‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎.github/workflows/pr_pipeline.yml‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: PR pipeline
2+
on:
3+
pull_request:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
9+
10+
jobs:
11+
build:
12+
name: Build & Test
13+
runs-on: ubuntu-24.04
14+
if: github.event.pull_request.draft == false
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set image name to lowercase
22+
run: echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >> $GITHUB_ENV
23+
env:
24+
IMAGE_NAME: ${{ github.repository }}
25+
26+
- name: Install Rust toolchain
27+
uses: dtolnay/rust-toolchain@stable
28+
with:
29+
components: clippy, rustfmt
30+
31+
- name: Cache cargo
32+
uses: Swatinem/rust-cache@v2
33+
34+
- name: Run Clippy
35+
run: cargo clippy --no-deps -- -Dwarnings
36+
37+
- name: Run rustfmt
38+
run: cargo fmt --check
39+
40+
- name: Build
41+
run: cargo build --release
42+
43+
- name: Run tests
44+
run: cargo test
45+
46+
- name: Install GitVersion
47+
uses: gittools/actions/gitversion/setup@v3
48+
49+
- name: Create GitVersion.yml
50+
run: |
51+
cat <<EOF > GitVersion.yml
52+
major-version-bump-message: '(breaking|major|incompatible):'
53+
minor-version-bump-message: '(feature|minor|enhancement|new|update|improvement|upgrade|feat):'
54+
patch-version-bump-message: '(fix|patch|bugfix|hotfix|correction|adjustment|tweak):'
55+
no-bump-message: '(none|skip|no-release|trivial|docs|documentation|style|refactor|chore|chore\(deps\)|test):'
56+
EOF
57+
58+
- name: Run GitVersion
59+
id: gitversion
60+
uses: gittools/actions/gitversion/execute@v3
61+
62+
- name: Display GitVersion
63+
run: |
64+
echo "Version: ${{ env.majorMinorPatch }}"
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Build Docker image (no push)
70+
uses: docker/build-push-action@v6
71+
with:
72+
context: .
73+
push: false
74+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:pr-${{ github.event.pull_request.number }}
75+
cache-from: type=gha
76+
cache-to: type=gha,mode=max
77+
env:
78+
DOCKER_BUILD_RECORD: false

‎.github/workflows/release.yml‎

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
release:
14+
name: Release
15+
runs-on: ubuntu-24.04
16+
permissions:
17+
contents: write
18+
packages: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set image name to lowercase
27+
run: echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >> $GITHUB_ENV
28+
env:
29+
IMAGE_NAME: ${{ github.repository }}
30+
31+
- name: Install Rust toolchain
32+
uses: dtolnay/rust-toolchain@stable
33+
with:
34+
components: clippy, rustfmt
35+
36+
- name: Cache cargo
37+
uses: Swatinem/rust-cache@v2
38+
39+
- name: Run Clippy
40+
run: cargo clippy --no-deps -- -Dwarnings
41+
42+
- name: Run rustfmt
43+
run: cargo fmt --check
44+
45+
- name: Build
46+
run: cargo build --release
47+
48+
- name: Run tests
49+
run: cargo test
50+
51+
- name: Install GitVersion
52+
uses: gittools/actions/gitversion/setup@v3
53+
54+
- name: Create GitVersion.yml
55+
run: |
56+
cat <<EOF > GitVersion.yml
57+
major-version-bump-message: '(breaking|major|incompatible):'
58+
minor-version-bump-message: '(feature|minor|enhancement|new|update|improvement|upgrade|feat):'
59+
patch-version-bump-message: '(fix|patch|bugfix|hotfix|correction|adjustment|tweak):'
60+
no-bump-message: '(none|skip|no-release|trivial|docs|documentation|style|refactor|chore|chore\(deps\)|test):'
61+
EOF
62+
63+
- name: Run GitVersion
64+
id: gitversion
65+
uses: gittools/actions/gitversion/execute@v3
66+
67+
- name: Display GitVersion
68+
run: |
69+
echo "Version: ${{ env.majorMinorPatch }}"
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Log in to Container Registry
75+
uses: docker/login-action@v3
76+
with:
77+
registry: ${{ env.REGISTRY }}
78+
username: ${{ github.actor }}
79+
password: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Build and push Docker image
82+
uses: docker/build-push-action@v6
83+
with:
84+
context: .
85+
platforms: linux/amd64,linux/arm64
86+
push: true
87+
tags: |
88+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:${{ env.majorMinorPatch }}
89+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:latest
90+
cache-from: type=gha
91+
cache-to: type=gha,mode=max
92+
93+
- name: Create tag
94+
uses: rickstaa/action-create-tag@v1
95+
with:
96+
tag: v${{ env.majorMinorPatch }}
97+
force_push_tag: true
98+
99+
- name: Create GitHub release
100+
uses: ncipollo/release-action@v1
101+
with:
102+
generateReleaseNotes: true
103+
tag: v${{ env.majorMinorPatch }}
104+
105+
# Integration tests
106+
- name: Pull image
107+
run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:${{ env.majorMinorPatch }}
108+
109+
- name: Run container
110+
run: |
111+
docker run -d --name naolametric-test \
112+
-p 8080:8080 \
113+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:${{ env.majorMinorPatch }}
114+
sleep 3
115+
116+
- name: Test health endpoint
117+
run: |
118+
response=$(curl -s http://localhost:8080/health)
119+
if [ "$response" != "OK" ]; then
120+
echo "Health check failed: $response"
121+
exit 1
122+
fi
123+
echo "Health check passed"
124+
125+
- name: Test stops endpoint
126+
run: |
127+
response=$(curl -s "http://localhost:8080/stops?search=commerce&limit=1")
128+
if ! echo "$response" | grep -q "COMM"; then
129+
echo "Stops endpoint failed: $response"
130+
exit 1
131+
fi
132+
echo "Stops endpoint passed"
133+
134+
- name: Test main endpoint
135+
run: |
136+
response=$(curl -s "http://localhost:8080/?stop=COMM")
137+
if ! echo "$response" | grep -q "frames"; then
138+
echo "Main endpoint failed: $response"
139+
exit 1
140+
fi
141+
echo "Main endpoint passed"
142+
143+
- name: Show logs
144+
if: always()
145+
run: docker logs naolametric-test || true
146+
147+
- name: Cleanup
148+
if: always()
149+
run: docker rm -f naolametric-test || true

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
# OS
1414
.DS_Store
1515
Thumbs.db
16+
17+
# Claude Code
18+
.claude/

0 commit comments

Comments
 (0)