Merge pull request #1351 from srbhr/remove-broken-tag-from-readme #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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* |