forked from NASA-AMMOS/anms-camp
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (168 loc) · 5.15 KB
/
build-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
##
## 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@apl-fy24"
jobs:
build:
runs-on: ubuntu-22.04
strategy:
max-parallel: 4
matrix:
python-version: ["3.10", "3.12"]
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", "3.12"]
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 '.[test]'
- name: Test
run: python3 -m pytest -v --cov=camp test
test-integration-sql:
needs: [build]
runs-on: ubuntu-22.04
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
env:
PGHOST: postgres
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: runner
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 dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
postgresql-client-14
- name: Test
run: ./integration-test/run.sh sql
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 build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cmake ninja-build ruby build-essential autoconf libtool \
flex libfl-dev bison libpcre2-dev civetweb libcivetweb-dev libssl-dev libcjson-dev
- name: Test
run: ./integration-test/run.sh c
flake8:
runs-on: ubuntu-22.04
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@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 build
- name: Build
run: python3 -m build
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1