Skip to content

Commit

Permalink
Merge branch 'topic/add_ci' into 'master'
Browse files Browse the repository at this point in the history
Enable GitLab CI

See merge request eng/ide/markdown!17
  • Loading branch information
reznikmm committed May 14, 2023
2 parents b9fcbb1 + b962021 commit 522ac06
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 6 deletions.
1 change: 1 addition & 0 deletions .aspell/.aspell.en.pws
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ commonmark
deallocation
elsif
gnatdoc
llvm
mailto
parsers
pos
Expand Down
65 changes: 65 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# In this CI, we should only work in reaction to a Merge Request

workflow:

rules:

- if: $CI_PIPELINE_SOURCE == "merge_request_event"

when: always

variables:
PIP_INDEX_URL: https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.adacore-it.com/api/v4/projects/it%2Fpackage-registry/packages/pypi/simple

.basic-setup:
- |
set -x
export PATH=/it/e3/bin:$PATH
- . ~/.aws_container_credentials

stages:
- build_and_test
- build_dependent

#########
# BUILD #
#########

build_and_test:
services:
- image:sandbox
stage: build_and_test
script:
- !reference [.basic-setup]

- |
# Install GNAT (with gcov) and gcovr
anod install --sandbox-dir /it/wave gnatall
python3 -m pip install gcovr
anod install --sandbox-dir /it/wave vss
# Fetch tests' data
PACKAGE=commonmark-spec.tar.bz2
DATA_URL=https://gitlab.adacore-it.com/api/v4/projects/eng%2Fide%2Fmarkdown
curl -L --header "JOB-TOKEN: $CI_JOB_TOKEN" \
$DATA_URL/packages/generic/$PACKAGE/0.0.0/$PACKAGE |\
tar xjf -
# Build Markdown and run tests
( eval $(anod printenv --sandbox-dir /it/wave gnatall) ;\
eval $(anod printenv --sandbox-dir /it/wave vss) ;\
make BUILD_MODE=coverage check ;\
ENABLE_GCOV=y gcovr --print-summary --cobertura gcov.xml )
# Run spell checker
- make spellcheck_json

coverage: /^\s*lines:\s*\d+.\d+\%/
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: gcov.xml
codequality:
- spellcheck.json

9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,12 @@ spellcheck:
echo "\n\nFIX SPELLING or append exceptions to .aspell/.aspell.en.pws !!!" ; \
exit 1 ; \
fi

spellcheck_json:
for J in `find source -name *.ad[sb]` README.md; do \
sed -e 's/#[^#]*#//g' -e "s/'\([A-Z]\)/ \1/g" $$J | \
aspell list --lang=en --home-dir=.aspell --ignore-case > /tmp/spell.txt; \
if [ -s /tmp/spell.txt ] ; then \
sort -u -f /tmp/spell.txt | jq -R --arg file "$$J" '{description: "Wrong spelling: \(.)", fingerprint: ., severity: "major", location: {path: $$file, lines: {begin: 1} }}' ; \
fi \
done | jq -s 'reduce inputs as $$in (.; . + $$in)' > spellcheck.json
14 changes: 8 additions & 6 deletions gnat/markdown.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,24 @@ project Markdown is

for Library_Kind use Library_Type;

Markdown_Ada_Compiler_Switches := ();
Markdown_Ada_Compiler_Switches := (
-- Disable short-circuit requirements
"-gnaty-B"
);

Coverage_Ada_Compiler_Switches := ();
Linker_Options := ();

case Build_Mode is
when "prod" =>
Markdown_Ada_Compiler_Switches := (
Markdown_Ada_Compiler_Switches := Markdown_Ada_Compiler_Switches & (
-- Generate debug information: this is useful to get meaningful
-- tracebacks.
"-g"
);

when "dev" =>
Markdown_Ada_Compiler_Switches := (
-- Enable warnings and stylechecks.
"-gnatygo",
Markdown_Ada_Compiler_Switches := Markdown_Ada_Compiler_Switches & (
-- g check standard GNAT style rules
-- o check subprogram bodies in alphabetical order

Expand All @@ -57,7 +59,7 @@ project Markdown is
);

when "coverage" =>
Markdown_Ada_Compiler_Switches := ();
Markdown_Ada_Compiler_Switches := Markdown_Ada_Compiler_Switches & ();

Coverage_Ada_Compiler_Switches := (
-- Enable coverage code instrumentation.
Expand Down

0 comments on commit 522ac06

Please sign in to comment.