-
Notifications
You must be signed in to change notification settings - Fork 3
111 lines (109 loc) · 3.63 KB
/
build.yaml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: ci
run-name: ci [${{ inputs.uuid && inputs.uuid || 'N/A' }}]
on:
push:
workflow_dispatch:
inputs:
uuid:
description: 'Unique ID'
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Define global variables
id: global_variables
run: |
echo "BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "CONTAINER_ID=${{ github.run_id }}" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Api
env:
CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }}
uses: docker/build-push-action@v6
with:
build-args: |
ADMIN_PASSWORD=dummy_password
API_PORT=5005
context: .
file: Dockerfile-api
push: false
no-cache: true
tags: basil-api_${{ env.CONTAINER_ID }}
outputs: type=docker,dest=/tmp/basil-api_${{ env.CONTAINER_ID }}.tar
- name: Build App
env:
CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }}
uses: docker/build-push-action@v6
with:
build-args: |
API_ENDPOINT=http://localhost:5005
APP_PORT=9056
context: .
file: Dockerfile-app
push: false
no-cache: true
tags: basil-app_${{ env.CONTAINER_ID }}
outputs: type=docker,dest=/tmp/basil-app_${{ env.CONTAINER_ID }}.tar
- name: Upload basil-api artifact
env:
CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }}
uses: actions/upload-artifact@v4
with:
name: basil-api
path: /tmp/basil-api_${{ env.CONTAINER_ID }}.tar
- name: Upload basil-app artifact
env:
CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }}
uses: actions/upload-artifact@v4
with:
name: basil-app
path: /tmp/basil-app_${{ env.CONTAINER_ID }}.tar
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Define global variables
id: global_variables
run: |
echo "BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "CONTAINER_ID=${{ github.run_id }}" >> "$GITHUB_OUTPUT"
- name: Download basil-api artifacts
uses: actions/download-artifact@v4
with:
name: basil-api
path: /tmp
- name: Download basil-app artifacts
uses: actions/download-artifact@v4
with:
name: basil-app
path: /tmp
- name: Load images
env:
CONTAINER_ID: ${{ steps.global_variables.outputs.CONTAINER_ID }}
run: |
docker load --input /tmp/basil-api_${{ env.CONTAINER_ID }}.tar
docker load --input /tmp/basil-app_${{ env.CONTAINER_ID }}.tar
docker image ls -a
docker run -d --network=host basil-api_${{ env.CONTAINER_ID }}
docker run -d --network=host basil-app_${{ env.CONTAINER_ID }}
sleep 60
docker ps
echo "Test Api is running"
curl -vf http://localhost:5005/version
echo "Test App is running"
curl -vf http://localhost:9056
- name: Cypress E2E Testing
uses: cypress-io/github-action@v6
with:
browser: chrome
spec: cypress/e2e/login.cy.js
env:
LIBGL_ALWAYS_SOFTWARE: 1