Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
example-citests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SSEC Developers
example-citests
Commits
625e9363
Verified
Commit
625e9363
authored
4 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Build the C program and add tests
parent
e6ad5205
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#11529
canceled
4 years ago
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+21
-2
21 additions, 2 deletions
.gitlab-ci.yml
my_utils.py
+1
-0
1 addition, 0 deletions
my_utils.py
src/hello_world.c
+1
-1
1 addition, 1 deletion
src/hello_world.c
test.py
+13
-0
13 additions, 0 deletions
test.py
with
36 additions
and
3 deletions
.gitlab-ci.yml
+
21
−
2
View file @
625e9363
stages
:
-
Build
-
Test
# Define environment variables for all stages
#variables:
# # Tell docker images where the host docker daemon is
...
...
@@ -26,10 +30,25 @@
# - if: $BUILD_CI_IMAGE
# when: always
build_hello_world
:
stage
:
Build
# image: gcc:9
script
:
-
gcc -o hello src/hello_world.c
artifacts
:
paths
:
-
hello
# Define stage that builds HTML and uploads the website
python_tests
:
tests
:
stage
:
Test
image
:
python:3.8-alpine
tags
:
-
ssec_shared
script
:
-
python my_utils.py
-
pip install -y pytest pytest-cov
-
pytest .
needs
:
-
job
:
build_hello_world
artifacts
:
true
This diff is collapsed.
Click to expand it.
my_utils.py
+
1
−
0
View file @
625e9363
#!/usr/bin/env python
"""
Helper methods that aren
'
t actually that helpful.
Just an example.
...
...
This diff is collapsed.
Click to expand it.
src/hello_world.c
+
1
−
1
View file @
625e9363
#include
<stdio.h>
int
main
()
{
printf
(
"Hello, World!"
);
printf
(
"Hello, World!
\n
"
);
return
0
;
}
This diff is collapsed.
Click to expand it.
test.py
0 → 100644
+
13
−
0
View file @
625e9363
#!/usr/bin/env python
"""
Basic tests using pytest.
"""
def
test_hello_world_c
():
import
subprocess
bytes_out
=
subprocess
.
check_output
([
'
./hello
'
])
assert
bytes_out
==
b
'
Hello World!
\n
'
def
test_hello_world_py
():
import
my_utils
my_utils
.
print_hello
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment