Skip to content
Snippets Groups Projects
Commit 9744f1e0 authored by Christophe Junke's avatar Christophe Junke Committed by Christophe Junke
Browse files

Release script

parent 74921898
No related branches found
No related tags found
1 merge request!45Release script
Pipeline #65660 passed
variables:
PROJECT: 'colibri'
ID: '804'
PROJECT_URI: 'https://git.frama-c.com/api/v4/projects/$ID'
stages:
- build
- test
build:
image: ocaml/opam@sha256:aabf10d76f588677f6ee8007aae3d4dd45d28000501abce5aabda9de50e88dc7
image: ocaml/opam:debian-10-ocaml-4.14
stage: build
script:
- sudo apt-get update
......@@ -13,15 +18,17 @@ build:
- make clean_bundle
- make
- make bundle
- make bundle.tbz
artifacts:
paths:
- bundle
- bundle.tbz
expire_in: 1 week
tags:
- docker
test:
image: debian@sha256:7ceacc4462a98718b236cbdeb850d4b7603afe4bab791336a0ed1c030f769f02
image: debian:10
stage: test
needs: [build]
script:
......@@ -35,3 +42,47 @@ test:
tags:
- docker
prepare-release:
image: debian:10
needs: [build]
rules:
- if: $CI_PIPELINE_SOURCE == "trigger"
variables:
ARCHIVE_NAME: '$PROJECT.$TAG.tbz'
PACKAGE_URI: '$PROJECT_URI/$PROJECT/$TAG/$ARCHIVE_NAME'
script:
- apt-get update
- apt-get install -y curl
- sed -n -f changelog.sed CHANGES.md > description.txt
- |
curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" --upload-file bundle.tbz "$PACKAGE_URI"
artifacts:
paths:
- description.txt
tags:
- docker
release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs: [prepare-release]
rules:
- if: $CI_PIPELINE_SOURCE == "trigger"
variables:
ARCHIVE_NAME: '$PROJECT.$TAG.tbz'
PACKAGE_URI: '$PROJECT_URI/$PROJECT/$TAG/$ARCHIVE_NAME'
script:
- echo "Release job for tag $TAG"
release:
name: "Release $TAG"
description: description.txt
tag_name: "$TAG"
ref: '$CI_COMMIT_SHA'
milestones: []
assets:
links:
- name: '$ARCHIVE_NAME'
url: '$PACKAGE_URI'
filepath: '/bundle'
link_type: 'other'
tags:
- docker
## Release 2024.02
* Use dune for ocaml tools
* Make release job on CI
## Release 2023.12
* Fix build
* Deploy a publicly downloadable bundle
......@@ -30,7 +30,9 @@ endef
# $(2): destination
#
define require_copy
$(eval $(call add_copy_rule,$(1),$(2)))
endef
# ==================================================
......@@ -75,7 +77,7 @@ simplex: $(ECLIPSEBIN)
cd $(COLIBRI)/simplex_ocaml && dune build $(SIMPLEX) simplex_ocaml.pl
simplex_epilog : simplex $(COPY_DEPS)
@true
@echo COPY_DEPS=$(COPY_DEPS)
# ==================================================
# FLOAT LIBRARY
......@@ -89,6 +91,7 @@ CPP_FILES := \
$(ROOT)/Floats/Floatcpp-3.0_SimFloat2.2.cpp
$(FLOAT_LIB) : $(CPP_FILES)
mkdir -p $(dir $@)
g++ $(CPP_FLAGS) $(CPP_FILES) -o $@
# ==================================================
......@@ -100,9 +103,11 @@ clean:
rm -f $(COLIBRI)/simplex_ocaml.pl
rm -f $(FLOAT_LIB)
rm -f compile_colibri
rm -rf $(PWD)/tools/_build/
compile_colibri : compile_colibri.ml
ocamlopt -o $@ -I +unix unix.cmxa $^
compile_colibri :
cd tools/ && dune build compile_colibri.exe
cp -a $(PWD)/tools/_build/default/compile_colibri.exe $@
build: simplex_epilog $(FLOAT_LIB) compile_colibri
./compile_colibri --eclipsedir $(ECLIPSEBIN)
......@@ -116,9 +121,9 @@ BUNDLE_SRC := \
Src/COLIBRI/filter_smtlib_file \
Src/COLIBRI/filter_smtlib_file.exe
$(BUNDLE)/colibri.exe : colibri_for_bundle.ml
ocamlopt -o $@ -I +unix unix.cmxa $^
chmod u+x $@
$(BUNDLE)/colibri.exe :
cd tools/ && dune build colibri_for_bundle.exe
cp -a $(PWD)/tools/_build/default/colibri_for_bundle.exe $@
clean_bundle:
rm -fr $(BUNDLE)
......@@ -126,8 +131,10 @@ clean_bundle:
$(BUNDLE):
mkdir -p $(BUNDLE)
bundle: $(BUNDLE) $(BUNDLE)/colibri.exe
cp $(BUNDLE)/colibri.exe $(BUNDLE)/colibri
$(BUNDLE)/colibri: $(BUNDLE)/colibri.exe
cp -ra $< $@
bundle: build $(BUNDLE) $(BUNDLE)/colibri.exe $(BUNDLE)/colibri
mkdir -p $(BUNDLE)/COLIBRI/lib/
cp -ra $(LIBDIR) $(BUNDLE)/COLIBRI/lib/
cp -ra $(BUNDLE_SRC) $(BUNDLE)/COLIBRI/
......@@ -135,5 +142,38 @@ bundle: $(BUNDLE) $(BUNDLE)/colibri.exe
cp -ra version $(BUNDLE)/
cp -ra $(ECLIPSEBIN) $(BUNDLE)/ECLIPSE/
bundle.tbz: bundle
tar cvfj $@ $<
# ==================================================
# TEST
# ==================================================
test:
./test.sh -j2
# ==================================================
# RELEASE
# ==================================================
PROJECT_URL := https://git.frama-c.com/api/v4/projects/804
RELEASE_REF ?= master
GIT_TAG ?= $(shell git describe --tags --candidates=0 2> /dev/null)
check_release:
@echo ''
@echo 'RELEASE'
$(if $(RELEASE_TOKEN),,$(error Call script with RELEASE_TOKEN set))
$(if $(GIT_TAG),,$(error No git tag associated with current commit; set GIT_TAG or add a tag))
@echo REF: $(RELEASE_REF)
@echo TAG: $(GIT_TAG)
@echo -n "Confirm? [y/N] " && read ans && [ $${ans:-N} = y ]
release: check_release
@echo RELEASING
curl --request POST \
--form token="$(RELEASE_TOKEN)" \
--form ref="$(RELEASE_REF)" \
--form variables[TAG]="$(GIT_TAG)" \
"$(PROJECT_URL)/trigger/pipeline"
# Read from markdown the first release section and its content. The
# expected format is a subset of Markdown that follows this pattern:
#
# ## Title containing "release" ....
# * only text
# * items can span multiple
# lines if necessary
# * other sections in the file are ignored
/^## .*\(r\|R\)elease/ b block
d # skip to next cyle
:block
h # append line in hold space
:next
z # zap (clear) pattern space
n # read next line
# end of block?
/^ *$/ {
z # zap line (so that next exchange clears hold space)
x # exchange with hold space
# use NUL to separate bullet points
s/\n *[*] */\d0/g
# join other lines together
s/ *\n */ /g
# trim lines
s/ *$//g
# Replace NUL by newlines and bullets
s/\d0/\n * /g
# print and quit (replace q by d to list all releases)
p
q
}
# line is not empty, append to hold space (with newline)
H
# read next line
b next
_build/
\ No newline at end of file
all:
dune build
File moved
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.4.0"
synopsis: "Executable around colibri when used in bundle"
maintainer: ["Christophe Junke"]
authors: ["François Bobot" "Bruno Marre" "Christophe Junke"]
license: "MIT"
homepage: "https://colibri.frama-c.com"
bug-reports: "https://git.frama-c.com/pub/colibri/issues"
depends: [
"dune" {>= "3.0"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
......@@ -27,7 +27,7 @@ let argspec =
let () = Arg.parse (Arg.align argspec)
(fun s -> invalid_arg "No anonymous argument")
(fun _ -> invalid_arg "No anonymous argument")
"compile_colibri"
let arch = if Sys.win32 then "x86_64_nt" else "x86_64_linux"
......
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.4.0"
synopsis: "Compile all dependencies for colibri"
maintainer: ["Christophe Junke"]
authors: ["François Bobot" "Bruno Marre" "Christophe Junke"]
license: "MIT"
homepage: "https://colibri.frama-c.com"
bug-reports: "https://git.frama-c.com/pub/colibri/issues"
depends: [
"dune" {>= "3.0"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
(env
(static
(ocamlopt_flags
:standard -O3
-ccopt -static
-ccopt -no-pie))
(_ (ocamlopt_flags
:standard -O3)))
(executable
(public_name colibri_for_bundle)
(package colibri_for_bundle)
(modules colibri_for_bundle)
(libraries unix))
(executable
(public_name compile_colibri)
(package compile_colibri)
(modules compile_colibri)
(libraries unix))
(lang dune 3.0)
(name colibri_tools)
(version 0.4.0)
(license "MIT")
(generate_opam_files true)
(strict_package_deps true)
(authors "François Bobot"
"Bruno Marre"
"Christophe Junke")
(homepage "https://colibri.frama-c.com")
(bug_reports "https://git.frama-c.com/pub/colibri/issues")
(package
(name colibri_for_bundle)
(synopsis "Executable around colibri when used in bundle")
(maintainers "Christophe Junke"))
(package
(name compile_colibri)
(synopsis "Compile all dependencies for colibri")
(maintainers "Christophe Junke"))
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