Skip to content

Update Terraform juju to ~> 0.15.0 #696

Update Terraform juju to ~> 0.15.0

Update Terraform juju to ~> 0.15.0 #696

Workflow file for this run

name: Test API server
on:
push:
branches: [ main ]
paths:
- server/**
pull_request:
branches: [ main ]
paths:
- server/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: [self-hosted, linux, large, jammy, x64]
defaults:
run:
working-directory: server
steps:
- name: Checkout repo & submodules
uses: actions/checkout@v4
with:
submodules: "true"
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
with:
config-inline: |
[registry."docker.io"]
mirrors = ["https://github-runner-dockerhub-cache.canonical.com:5000"]
- name: Install docker-compose
run: |
COMPOSE_URL="https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)"
echo "Downloading docker-compose from $COMPOSE_URL"
sudo curl -L -L $COMPOSE_URL -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo `docker-compose --version`
- name: Set dockerhub registry mirror at /etc/docker/daemon.json
run: |
echo '{"registry-mirrors": ["https://github-runner-dockerhub-cache.canonical.com:5000"]}' | sudo tee /etc/docker/daemon.json
- name: Restart dockerd
run: sudo systemctl restart docker
- name: Run tests with docker-compose
run: |
docker-compose up --attach-dependencies --abort-on-container-exit hwapi-test
sudo chown $USER -R coverage
sudo chgrp $USER -R coverage
- name: Upload coverage.xml as an artifact
uses: actions/upload-artifact@v4
with:
name: test_coverage
path: ./server/coverage/coverage.xml
if-no-files-found: error
retention-days: 2
report-coverage:
runs-on: [self-hosted, linux, large, jammy, x64]
if: github.event_name == 'pull_request'
needs: [test]
steps:
- name: Download build tests coverage report
uses: actions/download-artifact@v4
with:
name: test_coverage
- name: Report Coverage and annotate PR (if exists)
uses: orgoro/coverage@v3
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.70
thresholdNew: 0.80
thresholdModified: 0.0
compare-openapi:
runs-on: [self-hosted, linux, large, jammy, x64]
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: Gr1N/setup-poetry@12c727a3dcf8c1a548d8d041c9d5ef5cebb3ba2e
with:
poetry-version: "1.6.1"
- run: poetry install
- name: Start FastAPI application
run: poetry run uvicorn hwapi.main:app --port 8001 &
shell: bash
- name: Fetch OpenAPI YAML
run: curl http://localhost:8001/v1/openapi.yaml -o fetched_openapi.yaml
- name: Compare with repository's openapi.yaml
run: diff fetched_openapi.yaml schemas/openapi.yaml