-
Notifications
You must be signed in to change notification settings - Fork 70
180 lines (169 loc) · 6.53 KB
/
api_tests.yml
File metadata and controls
180 lines (169 loc) · 6.53 KB
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
178
179
180
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
# Reference environment variables: https://docs.github.com/en/actions/reference/environment-variables
name: API Tests
on:
push:
branches:
- main
pull_request:
branches:
- "**"
env:
RUBYOPT: --disable=frozen_string_literal
RUBYGEMS_URL: https://rubygems.org
BUNDLE_WITHOUT: development
OPENC3_REDIS_USERNAME: openc3
OPENC3_REDIS_PASSWORD: openc3password
OPENC3_REDIS_HOSTNAME: 127.0.0.1
OPENC3_REDIS_PORT: 6379
OPENC3_REDIS_EPHEMERAL_HOSTNAME: 127.0.0.1
OPENC3_REDIS_EPHEMERAL_PORT: 6380
OPENC3_SERVICE_PASSWORD: openc3service
jobs:
cmd-tlm-api:
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["3.3", "3.4"]
steps:
- uses: actions/checkout@v5
# Only needed for SonarQube Scan
# with:
# fetch-depth: 0 # all history for all branches and tags
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
env:
OPENC3_DEVEL: ../openc3
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
working-directory: openc3-cosmos-cmd-tlm-api
- name: Build OpenC3
run: bundle install; bundle exec rake build
working-directory: openc3
env:
OPENC3_DEVEL: ${GITHUB_WORKSPACE}/openc3
- name: Run cmd-tlm-api tests
run: bundle exec rspec
working-directory: openc3-cosmos-cmd-tlm-api
env:
OPENC3_DEVEL: ../openc3
- uses: codecov/codecov-action@v5
with:
directory: openc3-cosmos-cmd-tlm-api/coverage
flags: ruby-api # See codecov.yml
token: ${{ secrets.CODECOV_TOKEN }}
# Attempt at using separate SonarQube Scan task
# - name: Store coverage report
# uses: actions/upload-artifact@v4
# with:
# name: cmd-tlm-api-${{ matrix.ruby-version }}
# path: openc3-cosmos-cmd-tlm-api/coverage/coverage.json
script-runner-api-ruby:
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
strategy:
matrix:
# Note that the report-coverage job needs this value hard coded
ruby-version: ["3.3", "3.4"]
steps:
- uses: actions/checkout@v5
# Only needed for SonarQube Scan
# with:
# fetch-depth: 0
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
env:
OPENC3_DEVEL: ../openc3
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
working-directory: openc3-cosmos-script-runner-api
- name: Build OpenC3
run: bundle install; bundle exec rake build
working-directory: openc3
- name: Run script-runner-api tests
run: bundle exec rspec
working-directory: openc3-cosmos-script-runner-api
env:
OPENC3_DEVEL: ../openc3
- uses: codecov/codecov-action@v5
with:
directory: openc3-cosmos-script-runner-api/coverage
flags: ruby-api # See codecov.yml
token: ${{ secrets.CODECOV_TOKEN }}
# - name: Store coverage report
# uses: actions/upload-artifact@v4
# with:
# name: script-runner-api-ruby-${{ matrix.ruby-version }}
# path: openc3-cosmos-script-runner-api/coverage/coverage.json
script-runner-api-python:
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v5
# Only needed for SonarQube Scan
# with:
# fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
working-directory: openc3/python
- name: Lint with ruff
run: |
poetry run ruff check --output-format=github ../../openc3-cosmos-script-runner-api/scripts
working-directory: openc3/python
- name: Run unit tests
run: |
poetry run coverage run -m pytest ../../openc3-cosmos-script-runner-api/test/
poetry run coverage xml -i
working-directory: openc3/python
- uses: codecov/codecov-action@v5
with:
working-directory: openc3/python
flags: python # See codecov.yml
token: ${{ secrets.CODECOV_TOKEN }}
# - name: Store coverage report
# uses: actions/upload-artifact@v4
# with:
# name: script-runner-api-python-${{ matrix.python-version }}
# path: openc3/python/coverage.xml
# This was an attempt to use SonarQube to report coverage
# It is currently disabled because we reverted to Automatic Analysis
# report-coverage:
# needs: [cmd-tlm-api, script-runner-api-ruby, script-runner-api-python]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# with:
# fetch-depth: 0
# - name: Download coverage reports
# uses: actions/download-artifact@v4
# - name: SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@v5
# with:
# args: >
# -Dsonar.organization=openc3
# -Dsonar.projectKey=OpenC3_cosmos
# -Dsonar.python.coverage.reportPaths=script-runner-api-python-3.12/coverage.xml
# -Dsonar.ruby.coverage.reportPaths=cmd-tlm-api-3.3/coverage.json,script-runner-api-ruby-3.3/coverage.json
# -Dsonar.sources=openc3/lib,openc3/python,openc3-cosmos-cmd-tlm-api/app,openc3-cosmos-script-runner-api/app,openc3-cosmos-script-runner-api/scripts
# -Dsonar.tests=openc3-cosmos-cmd-tlm-api/spec,openc3-cosmos-script-runner-api/spec,openc3-cosmos-script-runner-api/test
# -Dsonar.test.exclusions=openc3-cosmos-cmd-tlm-api/spec/fixtures/**/*
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}