Skip to content

Integration tests for camp-generated files (#1) #121

Integration tests for camp-generated files (#1)

Integration tests for camp-generated files (#1) #121

Workflow file for this run

##
## Copyright (c) 2020-2024 The Johns Hopkins University Applied Physics
## Laboratory LLC.
##
## This file is part of the C code generator for AMP (CAMP) under the
## DTN Management Architecture (DTNMA) reference implementaton set from APL.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
## http://www.apache.org/licenses/LICENSE-2.0
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## Portions of this work were performed for the Jet Propulsion Laboratory,
## California Institute of Technology, sponsored by the United States Government
## under the prime contract 80NM0018D0004 between the Caltech and NASA under
## subcontract 1658085.
##
name: Build and run tests
on: [push]
env:
ACE_REPO: "git+https://github.com/JHUAPL-DTNMA/dtnma-ace.git@aa879be"
jobs:
build:
runs-on: ubuntu-22.04
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Prep
run: |
pip3 install ${ACE_REPO}
pip3 install build
- name: Build
run: python3 -m build
unit-test:
needs: [build]
runs-on: ubuntu-22.04
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Prep
run: |
pip3 install ${ACE_REPO}
pip3 install -e '.[test]'
- name: Test
run: python3 -m pytest -v --cov=camp tests/unit_test
test-integration-sql:
needs: [build]
runs-on: ubuntu-22.04
# Job executes within a container
container: ubuntu:22.04
services:
postgres:
image: postgres:14
env:
POSTGRES_DB: runner
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
PGHOST: postgres
PGDATABASE: runner
PGUSER: postgres
PGPASSWORD: postgres
steps:
- name: Prep Container OS
run: |
apt-get update
apt-get install -y git postgresql-client-14 python3-pip
pip3 install --upgrade pip
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prep ANMS database
run: |
git clone https://github.com/NASA-AMMOS/anms.git tests/integration_test/anms
cd tests/integration_test/anms/amp-sql/postgres
psql -f Database_Scripts/Tables/amp_core_create_database.sql
psql -f Database_Scripts/Tables/transcoder.sql
psql -f Database_Scripts/Tables/adm_data.sql
psql -f Database_Scripts/Views/obj_view.sql
psql -f Database_Scripts/Views/ari_view.sql
psql -f Database_Scripts/Views/ctrl_view.sql
psql -f Database_Scripts/Views/edd_view.sql
psql -f Database_Scripts/Views/mac_view.sql
psql -f Database_Scripts/Views/oper_view.sql
psql -f Database_Scripts/Views/message_view.sql
psql -f Database_Scripts/Views/rpt_view.sql
psql -f Database_Scripts/Views/sbr_view.sql
psql -f Database_Scripts/Views/tbr_view.sql
psql -f Database_Scripts/Views/tblt_view.sql
psql -f Database_Scripts/Views/tnvc_view.sql
psql -f Database_Scripts/Views/parm_view.sql
psql -f Database_Scripts/Views/var_view.sql
psql -f Database_Scripts/Views/namespace_view.sql
psql -f Database_Scripts/Routines/all_routines.sql
psql -f Database_Scripts/Tables/healthcheck_roles.sql
psql -f Database_Scripts/amp_core_functions.sql
- name: Install
run: |
pip3 install ${ACE_REPO}
pip install -e '.[test]'
git clone https://github.com/JHUAPL-DTNMA/dtnma-adms.git tests/integration_test/anms-adms
- name: Test
run: python3 -m pytest -v --cov=camp tests/integration_test/test_sql_integration.py
test-integration-c:
needs: [build]
runs-on: ubuntu-22.04
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
pip3 install ${ACE_REPO}
pip3 install -e '.[test]'
- name: Prep repos
run: |
git clone https://github.com/JHUAPL-DTNMA/dtnma-adms.git tests/integration_test/anms-adms
git clone https://github.com/JHUAPL-DTNMA/dtnma-tools.git tests/integration_test/dtnma-tools
sudo apt-get update
sudo apt-get install -y cmake ninja-build ruby build-essential autoconf libtool civetweb libcivetweb-dev libssl-dev libcjson-dev
cd tests/integration_test/dtnma-tools
git submodule update --init --recursive
./prep.sh
./build.sh check
- name: Test
run: python3 -m pytest -v --cov=camp tests/integration_test/test_c_integration.py
flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Prep
run: |
pip3 install ${ACE_REPO}
pip3 install -e '.[flake8]'
- name: Run flake8
run: |
FAIL_SRC=0
flake8 src || FAIL_SRC=$?
release:
needs: [unit-test, test-integration-c, test-integration-sql, flake8]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Prep
run: pip3 install build
- name: Build
run: python3 -m build
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1