forked from swirlai/swirl-search
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (114 loc) · 4.54 KB
/
test-build-pipeline.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Test and Build Pipeline
on:
push:
branches:
- main
- develop
paths-ignore:
- .github/**
- docs/**
- README.md
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout the Code
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.1'
cache: 'pip'
- name: Install Swirl
run: ./install.sh
- name: Install the Unit Tests
run: ./install-test.sh
- name: Run the Unit Tests
run: pytest
qa-suite:
needs: unit-tests
runs-on: ubuntu-latest
steps:
- name: Checkout the Code
uses: actions/checkout@v4
- name: Start Application Environment
run: docker-compose up -d
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Wait for Application to be Ready
run: |
echo "Waiting for the application to become ready..."
max_attempts=10
count=0
until curl --output /dev/null --silent --head --fail http://localhost:8000/galaxy/login; do
count=$(($count+1))
if [ $count -ge $max_attempts ]; then
echo "Application did not become ready in time."
exit 1
fi
printf '.'
sleep 30
done
echo "Application is ready."
- name: Create env File
run: |
echo "SWIRL_TEST_HOST=localhost" > .env
echo "QA_ADMIN_USER=${{ secrets.QA_ADMIN_USER }}" >> .env
echo "QA_ADMIN_PW=${{ secrets.QA_ADMIN_PW }}" >> .env
- name: Run the QA Suite
run: docker run --net=host --env-file .env -t swirlai/swirl-search-qa:automated-tests-master sh -c "behave --tags=qa_suite,community"
- name: Cleanup Application Environment
run: docker-compose down
swirl-docker:
needs: qa-suite
runs-on: ubuntu-latest
steps:
- name: Checkout the Code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Swirl Docker Image
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
TAG_NAME=$([ "$BRANCH_NAME" = "main" ] && echo "latest" || echo "$BRANCH_NAME")
docker buildx use devBuilder || docker buildx create --name devBuilder --use
docker buildx build -t swirlai/swirl-search:$TAG_NAME --platform linux/amd64,linux/arm64 --push .
- name: Update the Docker Repo Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME_X }}
password: ${{ secrets.DOCKER_PASSWORD_X }}
repository: swirlai/swirl-search
standalone-docker:
needs: swirl-docker
runs-on: ubuntu-latest
steps:
- name: Checkout the Code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Standalone Docker Image
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
TAG_SUFFIX="-sa"
TAG_NAME=$([ "$BRANCH_NAME" = "main" ] && echo "latest$TAG_SUFFIX" || echo "$BRANCH_NAME$TAG_SUFFIX")
docker buildx use devBuilder || docker buildx create --name devBuilder --use
docker buildx build -f DevUtils/docker/Dockerfile.sa --platform linux/amd64,linux/arm64 -t swirlai/swirl-search:${TAG_NAME} --push .
- name: Upload Log Files
if: always()
uses: actions/upload-artifact@v4
with:
name: log-files
path: |
logs/
/var/log/syslog*