Skip to content
Snippets Groups Projects
Verified Commit 625e9363 authored by David Hoese's avatar David Hoese
Browse files

Build the C program and add tests

parent e6ad5205
No related branches found
No related tags found
No related merge requests found
Pipeline #11529 canceled
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
#!/usr/bin/env python
"""Helper methods that aren't actually that helpful.
Just an example.
......
#include <stdio.h>
int main() {
printf("Hello, World!");
printf("Hello, World!\n");
return 0;
}
test.py 0 → 100644
#!/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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment