Skip to content

Merge pull request #37 from elisa-tech/document-work-item #13

Merge pull request #37 from elisa-tech/document-work-item

Merge pull request #37 from elisa-tech/document-work-item #13

Workflow file for this run

name: ci
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Print current branch
run: echo "${BRANCH_NAME}"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
- 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:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
uses: docker/build-push-action@v6
with:
build-args: |
ADMIN_PASSWORD=admin
API_PORT=5000
context: .
file: Dockerfile-api
push: false
tags: basil-api_${{ env.BRANCH_NAME }}
outputs: type=docker,dest=/tmp/basil-api.tar
- name: Build App
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
uses: docker/build-push-action@v6
with:
build-args: |
API_ENDPOINT=http://localhost:5000
context: .
file: Dockerfile-app
push: false
tags: basil-app_${{ env.BRANCH_NAME }}
outputs: type=docker,dest=/tmp/basil-app.tar
- name: Upload basil-api artifact
uses: actions/upload-artifact@v4
with:
name: basil-api
path: /tmp/basil-api.tar
- name: Upload basil-app artifact
uses: actions/upload-artifact@v4
with:
name: basil-app
path: /tmp/basil-app.tar
test:
runs-on: ubuntu-latest
needs: build
steps:
- 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:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
docker load --input /tmp/basil-api.tar
docker load --input /tmp/basil-app.tar
docker image ls -a
docker run -d --privileged --network=host basil-api_${{ env.BRANCH_NAME }}
docker run -d --network=host basil-app_${{ env.BRANCH_NAME }}
sleep 60
docker ps
echo "Test Api is running"
curl -vf http://localhost:5000/version
echo "Test App is running"
curl -vf http://localhost:9000