-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
547fefb
commit 3d01ca6
Showing
1 changed file
with
115 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Integration test | ||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
REDIS_VERSION: 6 | ||
PYTHON_VERSION: 3.8 | ||
MOSQUITTO_VERSION: 2.0 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit_test_backend: | ||
name: Unit testing backend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Start Redis ${{env.REDIS_VERSION}} | ||
uses: supercharge/[email protected] | ||
with: | ||
redis-version: ${{env.REDIS_VERSION}} | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
- name: Start Mosquitto broker ${{env.MOSQUITTO_VERSION}} | ||
uses: Namoshek/mosquitto-github-action@v1 | ||
with: | ||
version: ${{env.MOSQUITTO_VERSION}} | ||
ports: '1883:1883' | ||
- name: Set up Python ${{env.PYTHON_VERSION}} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{env.PYTHON_VERSION}} | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
working-directory: ./back | ||
- name: Test | ||
run: python -m unittest discover | ||
working-directory: ./back | ||
build_and_push_backend: | ||
name: Build and push backend | ||
runs-on: ubuntu-latest | ||
needs: unit_test_backend | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.PACKAGES_TOKEN }} | ||
- name: Build and push BE | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./docker/Dockerfile-back | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/homewarelan-back:dev | ||
build_push_frontend: | ||
name: Build and push frontend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.PACKAGES_TOKEN }} | ||
- name: Build and push FE | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./docker/Dockerfile-nginx | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/homewarelan-nginx:dev | ||
create_gcloud_vm: | ||
name: Create VM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: "actions/checkout@v3" | ||
- uses: "google-github-actions/auth@v1" | ||
with: | ||
credentials_json: ${{ secrets.GCLOUD_SERVICE_ACCOUNT }} | ||
- name: Setup Google Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v1 | ||
with: | ||
version: ">= 363.0.0" | ||
project_id: ${{ secrets.GCLOUD_PROJECT_ID }} | ||
- id: "gce_instance" | ||
uses: "aplr/[email protected]" | ||
with: | ||
name_prefix: "homeware-integration-test" | ||
source_instance_template: ${{ secrets.GCLOUD_MACHINE_TEMPLATE }} | ||
- name: "Use output" | ||
run: 'curl "${{ steps.gce_instance.outputs.instance_ip }}"' |