Skip to content

Commit

Permalink
Deduplicate code generation in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
treiher committed Aug 18, 2023
1 parent d1310af commit 2b36c65
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
36 changes: 35 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,34 @@ checks:
- *setup_python
- make check

code_generation:
extends: .testing
services:
- image:recordflux
- cpu:4
- mem:4
script:
- *setup_python
- make generate_apps
artifacts:
paths:
- examples/apps/*/build/generated

.update_timestamps_of_generated_code: &update_timestamps_of_generated_code
- touch examples/apps/*/build/generated/*

tests:
extends: .testing
needs:
- setup
- code_generation
services:
- image:recordflux
- cpu:8
- mem:16
script:
- git fetch --unshallow
- *update_timestamps_of_generated_code
- *setup_gnat
- *setup_gnat_cross
- *setup_python
Expand All @@ -188,6 +208,9 @@ python_compatibility:

gnat_pro_compatibility:
extends: .testing
needs:
- setup
- code_generation
services:
- image:recordflux
- cpu:2
Expand All @@ -204,6 +227,7 @@ gnat_pro_compatibility:
CLEAN_RECORDFLUX_SETUP: 1
script:
- git fetch --unshallow
- *update_timestamps_of_generated_code
- *setup_gnat
- *activate_nvm
- *setup_python
Expand All @@ -212,6 +236,9 @@ gnat_pro_compatibility:

gnat_fsf_compatibility:
extends: .testing
needs:
- setup
- code_generation
services:
- image:recordflux
- cpu:2
Expand All @@ -224,6 +251,7 @@ gnat_fsf_compatibility:
CLEAN_RECORDFLUX_SETUP: 1
script:
- git fetch --unshallow
- *update_timestamps_of_generated_code
- $CI_PROJECT_DIR/alr -n init --lib alire
- pushd alire
- $CI_PROJECT_DIR/alr toolchain --select --local gnat_native=$GNAT_VERSION gprbuild=22.0.1
Expand All @@ -238,6 +266,9 @@ gnat_fsf_compatibility:

gnat_community_compatibility:
extends: .testing
needs:
- setup
- code_generation
services:
- image:recordflux
- cpu:2
Expand All @@ -250,6 +281,7 @@ gnat_community_compatibility:
CLEAN_RECORDFLUX_SETUP: 1
script:
- git fetch --unshallow
- *update_timestamps_of_generated_code
- curl -L "https://raw.githubusercontent.com/AdaCore/gnat_community_install_script/master/install_package.sh" -o install_package.sh
- curl -L "https://raw.githubusercontent.com/AdaCore/gnat_community_install_script/master/install_script.qs" -o install_script.qs
- if [ $GNAT_VERSION == "2021" ]; then
Expand Down Expand Up @@ -306,8 +338,9 @@ verification_python_tests:

verification_apps:
extends: .testing
dependencies:
needs:
- setup
- code_generation
services:
- image:recordflux
- cpu:4
Expand All @@ -318,6 +351,7 @@ verification_apps:
- "ping"
- "dhcp_client"
script:
- *update_timestamps_of_generated_code
- *setup_gnat
- *setup_spark
- *setup_python
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ADASAT_HEAD = f948e2271aec51f9313fa41ff3c00230a483f9e8
SHELL = /bin/bash
PYTEST = python3 -m pytest -n$(TEST_PROCS) -vv --timeout=7200

APPS := $(filter-out __init__.py,$(notdir $(wildcard examples/apps/*)))

export PYTHONPATH := $(MAKEFILE_DIR)

# Switch to a specific revision of the git repository.
Expand Down Expand Up @@ -151,10 +153,7 @@ test_optimized:
PYTHONOPTIMIZE=1 $(PYTEST) tests/unit tests/integration tests/compilation

test_apps:
$(MAKE) -C examples/apps/ping test_python
$(MAKE) -C examples/apps/ping test_spark
$(MAKE) -C examples/apps/dhcp_client test
$(MAKE) -C examples/apps/spdm_responder test
$(foreach app,$(APPS),$(MAKE) -C examples/apps/$(app) test || exit;)

test_compilation:
# Skip test for FSF GNAT to prevent violations of restriction "No_Secondary_Stack" in AUnit units
Expand Down Expand Up @@ -198,9 +197,7 @@ prove_python_tests: $(GNATPROVE_CACHE_DIR)
$(PYTEST) tests/verification

prove_apps: $(GNATPROVE_CACHE_DIR)
$(MAKE) -C examples/apps/ping prove
$(MAKE) -C examples/apps/dhcp_client prove
$(MAKE) -C examples/apps/spdm_responder prove
$(foreach app,$(APPS),$(MAKE) -C examples/apps/$(app) prove || exit;)

prove_property_tests: $(GNATPROVE_CACHE_DIR)
$(PYTEST) tests/property_verification
Expand Down Expand Up @@ -243,11 +240,14 @@ printenv_gnat:
alr printenv \
) || true

.PHONY: generate
.PHONY: generate generate_apps

generate:
tools/generate_spark_test_code.py

generate_apps:
$(foreach app,$(APPS),$(MAKE) -C examples/apps/$(app) generate || exit;)

.PHONY: doc html_doc pdf_doc

doc: html_doc pdf_doc
Expand Down

0 comments on commit 2b36c65

Please sign in to comment.