Commit 616bad3c authored by ASN.1 Documenter's avatar ASN.1 Documenter
Browse files

CI/CD scripts

parent bf10a0bc
Loading
Loading
Loading
Loading

.gitlab-ci.mk

0 → 100755
+24 −0
Original line number Diff line number Diff line
ASN1_SRC   :=  $(wildcard *.asn)

ASN1_PDU := Ieee1609Dot2Data Certificate
#ASN1_KNOWN := DATE

#ASN1CDIR    ?= $(USERPROFILE)/Work/asn1c-fillabs
ifneq (,$(ASN1CDIR))
  ASN1C := $(ASN1CDIR)/asn1c/.libs/asn1c -S $(ASN1CDIR)/skeletons
else
  ASN1C := asn1c
endif

.PHONY: validate doc build

validate: iso build

doc: docs
	python3 asn2md.py -o docs $(ASN1_SRC)

iso docs:
	mkdir -p $@

build: $(ASN1_SRC) $(ASN1_SRC_VALIDATE)
	$(ASN1C) -E -F -fcompound-names $(addprefix -fknown-extern-type=,$(ASN1_KNOWN)) $(addprefix -pdu=,$(ASN1_PDU)) $^ >/dev/null

.gitlab-ci.yml

0 → 100755
+29 −0
Original line number Diff line number Diff line
variables:
 GIT_SUBMODULE_STRATEGY: normal

image: danya25/asn1c:0.0.5

validate:
  stage: test
  script: make -f .gitlab-ci.mk validate
  only:
    changes:
      - "asn/*.asn"

documentation:
  stage: deploy
  script:
    - curl --header "PRIVATE-TOKEN:$CI_DOC_TOKEN" https://forge.etsi.org/rep/api/v4/projects/592/repository/files/asn2md.py?ref=master | python3 -c "import sys, json, base64; open('asn2md.py', 'wb').write(base64.b64decode(json.load(sys.stdin)['content']))"
    - make -f .gitlab-ci.mk doc
    - >
      if [ -z "$(git status --untracked-files=no --porcelain)" ]; then
        echo "No changes found";
      else 
        git add docs/*.md &&
        git commit -m "Documentation update" &&
        git remote rm origin && git remote add origin https://oauth2:$CI_DOC_TOKEN@forge.etsi.org/rep/$CI_PROJECT_PATH.git &&
        git push origin HEAD:$CI_COMMIT_REF_NAME;
      fi
  only:
    changes:
      - "asn/*.asn"