/
/
/
Top level project for the bag recorder project that adds the frontend and backend together.
1name: CI/CD Pipeline for the bag recorder project
2
3on:
4 push:
5 branches:
6 - main
7
8jobs:
9 build-test-push-frontend:
10 runs-on: ubuntu-latest
11 steps:
12 - name: Checkout repository with submodules
13 uses: actions/checkout@v4
14 with:
15 submodules: recursive
16
17 - name: Set up Docker Buildx
18 uses: docker/setup-buildx-action@v3
19
20 - name: Login to Harbor Registry
21 uses: docker/login-action@v3
22 with:
23 registry: ${{ secrets.HARBOR_URL }}
24 username: ${{ secrets.HARBOR_USERNAME }}
25 password: ${{ secrets.HARBOR_PASSWORD }}
26
27 - name: Install Node.js for testing
28 run: |
29 apk add --no-cache nodejs npm
30
31 - name: Install frontend dependencies
32 working-directory: bag_recorder_frontend
33 run: npm ci
34
35 - name: Run frontend lint
36 working-directory: bag_recorder_frontend
37 run: npm run lint
38
39 - name: Run frontend type-check
40 working-directory: bag_recorder_frontend
41 run: npm run type-check
42
43 - name: Build and push frontend image
44 uses: docker/build-push-action@v5
45 with:
46 context: ./bag_recorder_frontend
47 push: true
48 tags: |
49 ${{ secrets.HARBOR_FRONTEND_IMAGE }}:latest
50 ${{ secrets.HARBOR_FRONTEND_IMAGE }}:${{ github.sha }}
51 cache-from: type=registry,ref=${{ secrets.HARBOR_FRONTEND_IMAGE }}:buildcache
52 cache-to: type=registry,ref=${{ secrets.HARBOR_FRONTEND_IMAGE }}:buildcache,mode=max
53
54 build-test-push-backend:
55 runs-on: docker
56 container:
57 image: docker:24-dind
58 services:
59 docker:
60 image: docker:24-dind
61 options: --privileged
62 steps:
63 - name: Checkout repository with submodules
64 uses: actions/checkout@v4
65 with:
66 submodules: recursive
67
68 - name: Set up Docker Buildx
69 uses: docker/setup-buildx-action@v3
70
71 - name: Login to Harbor Registry
72 uses: docker/login-action@v3
73 with:
74 registry: ${{ secrets.HARBOR_URL }}
75 username: ${{ secrets.HARBOR_USERNAME }}
76 password: ${{ secrets.HARBOR_PASSWORD }}
77
78 - name: Build and push backend image
79 uses: docker/build-push-action@v5
80 with:
81 context: ./bag_recorder_backend
82 push: true
83 tags: |
84 ${{ secrets.HARBOR_BACKEND_IMAGE }}:latest
85 ${{ secrets.HARBOR_BACKEND_IMAGE }}:${{ github.sha }}
86 cache-from: type=registry,ref=${{ secrets.HARBOR_BACKEND_IMAGE }}:buildcache
87 cache-to: type=registry,ref=${{ secrets.HARBOR_BACKEND_IMAGE }}:buildcache,mode=max
88 build-args: |
89 ROS_DISTRO=humble
90