mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-05-05 08:54:27 -04:00
use docker images for CI
This commit is contained in:
parent
8ebc582a00
commit
f7e11753e2
8 changed files with 156 additions and 83 deletions
20
.github/workflows/format.yml
vendored
20
.github/workflows/format.yml
vendored
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
name: format
|
||||
|
||||
on:
|
||||
|
|
@ -11,20 +9,10 @@ on:
|
|||
jobs:
|
||||
format:
|
||||
name: format
|
||||
strategy:
|
||||
matrix:
|
||||
ocaml-compiler:
|
||||
- '5.3'
|
||||
runs-on: 'ubuntu-latest'
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.14:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- name: Use OCaml ${{ matrix.ocaml-compiler }}
|
||||
uses: ocaml/setup-ocaml@v3
|
||||
with:
|
||||
ocaml-compiler: ${{ matrix.ocaml-compiler }}
|
||||
dune-cache: true
|
||||
allow-prerelease-opam: true
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: opam install ocamlformat.0.27.0 lwt.6.1.1
|
||||
- run: opam exec -- make format-check
|
||||
|
||||
|
|
|
|||
30
.github/workflows/gh-pages.yml
vendored
30
.github/workflows/gh-pages.yml
vendored
|
|
@ -8,27 +8,23 @@ on:
|
|||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-5.4:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
|
||||
# needed for depext to work
|
||||
- run: sudo apt-get update && sudo apt-get install mccs
|
||||
|
||||
- uses: ocaml/setup-ocaml@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ocaml-compiler: '5.1.x'
|
||||
dune-cache: true
|
||||
allow-prerelease-opam: true
|
||||
submodules: recursive
|
||||
|
||||
- run: |
|
||||
opam pin trace https://github.com/ocaml-tracing/ocaml-trace.git#main -y -n
|
||||
opam pin https://github.com/ocaml-tracing/ambient-context.git#main -y -n
|
||||
- name: Install local packages
|
||||
run: opam exec -- dune build @install && opam exec -- dune install
|
||||
|
||||
- name: Deps
|
||||
run: opam install odig opentelemetry opentelemetry-client opentelemetry-lwt opentelemetry-cohttp opentelemetry-client-ocurl opentelemetry-client-ocurl-lwt opentelemetry-cohttp-lwt opentelemetry-cohttp-eio
|
||||
|
||||
- name: Build
|
||||
run: opam exec -- odig odoc --cache-dir=_doc/ opentelemetry opentelemetry-client opentelemetry-lwt opentelemetry-cohttp opentelemetry-client-ocurl opentelemetry-client-ocurl-lwt opentelemetry-cohttp-lwt opentelemetry-cohttp-eio
|
||||
- name: Build documentation
|
||||
run: |
|
||||
opam exec -- odig odoc --cache-dir=_doc/ \
|
||||
opentelemetry opentelemetry-client opentelemetry-lwt \
|
||||
opentelemetry-cohttp-lwt opentelemetry-client-ocurl \
|
||||
opentelemetry-client-ocurl-lwt opentelemetry-client-cohttp-lwt \
|
||||
opentelemetry-client-cohttp-eio opentelemetry-logs
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
|
|
|
|||
73
.github/workflows/main.yml
vendored
73
.github/workflows/main.yml
vendored
|
|
@ -11,17 +11,19 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
#- windows-latest
|
||||
#- macos-latest
|
||||
ocaml-compiler:
|
||||
- 4.08.x
|
||||
- 4.13.x
|
||||
- 5.0.x
|
||||
- 5.3.x
|
||||
include:
|
||||
- ocaml-version: "4.08"
|
||||
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.08:latest
|
||||
eio: false
|
||||
- ocaml-version: "4.14"
|
||||
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.14:latest
|
||||
eio: false
|
||||
- ocaml-version: "5.4"
|
||||
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-5.4:latest
|
||||
eio: true
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{ matrix.container }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
|
@ -29,47 +31,18 @@ jobs:
|
|||
with:
|
||||
submodules: recursive
|
||||
|
||||
# needed for depext to work
|
||||
- run: sudo apt-get update && sudo apt-get install mccs
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
- name: Build
|
||||
run: opam exec -- dune build @install -p opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-cohttp-lwt,opentelemetry-client-ocurl,opentelemetry-client-ocurl-lwt,opentelemetry-client-cohttp-lwt,opentelemetry-logs
|
||||
|
||||
- name: Use OCaml ${{ matrix.ocaml-compiler }}
|
||||
uses: ocaml/setup-ocaml@v3
|
||||
with:
|
||||
ocaml-compiler: ${{ matrix.ocaml-compiler }}
|
||||
opam-depext-flags: --with-test
|
||||
dune-cache: true
|
||||
allow-prerelease-opam: true
|
||||
- name: Build eio packages
|
||||
if: ${{ matrix.eio }}
|
||||
run: opam exec -- dune build @install -p opentelemetry-client-cohttp-eio
|
||||
|
||||
- run: |
|
||||
opam install pbrt.4.0 -y
|
||||
opam install ambient-context lwt.5.9.2
|
||||
- name: Lint (protoc check)
|
||||
run: opam exec -- dune build @lint
|
||||
|
||||
# We cannot install packages that need eio on ocaml versions before 5
|
||||
- run: |
|
||||
packages=$(ls ./*.opam | grep -v eio)
|
||||
opam install $packages --deps-only --with-test --solver=mccs
|
||||
if: ${{ ! (startsWith(matrix.ocaml-compiler, '5')) }}
|
||||
- name: Check no generated files changed
|
||||
run: git diff --exit-code
|
||||
|
||||
# We should be able to install all packages on ocaml 5
|
||||
- run: opam install . --deps-only --with-test --solver=mccs
|
||||
if: ${{ startsWith(matrix.ocaml-compiler, '5') }}
|
||||
|
||||
- run: opam exec -- dune build @install -p opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-client-ocurl,opentelemetry-cohttp-lwt,opentelemetry-client-cohttp-lwt,opentelemetry-logs
|
||||
|
||||
- run: opam install trace
|
||||
- run: opam exec -- dune build @install -p opentelemetry
|
||||
|
||||
- run: opam install lwt.6.1.1 -y
|
||||
if: ${{ matrix.ocaml-compiler == '5.3.x' }}
|
||||
- run: opam exec -- dune build @install -p opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-client-cohttp-lwt
|
||||
if: ${{ matrix.ocaml-compiler == '5.3.x' }}
|
||||
|
||||
- run: opam install ocaml-protoc
|
||||
- run: opam exec -- dune build @lint
|
||||
|
||||
# check that nothing changed
|
||||
- run: git diff --exit-code
|
||||
|
||||
- run: opam exec -- dune build @runtest
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
- name: Run tests
|
||||
run: opam exec -- dune build @runtest
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -7,3 +7,4 @@ _opam
|
|||
*.install
|
||||
*.exe
|
||||
*.tmp
|
||||
/.env
|
||||
|
|
|
|||
14
Makefile
14
Makefile
|
|
@ -36,6 +36,20 @@ WATCH ?= @all
|
|||
watch:
|
||||
@dune build $(WATCH) -w $(OPTS)
|
||||
|
||||
# --- CI Docker images ---
|
||||
CI_REGISTRY = ghcr.io/ocaml-tracing/ocaml-opentelemetry
|
||||
CI_VERSIONS = 4.08 4.14 5.4
|
||||
|
||||
build-ci-docker:
|
||||
@for v in $(CI_VERSIONS); do \
|
||||
docker build -f deps/dockerfile.$$v -t $(CI_REGISTRY)/ci-$$v:latest . ; \
|
||||
done
|
||||
|
||||
upload-ci-docker: build-ci-docker
|
||||
@for v in $(CI_VERSIONS); do \
|
||||
docker push $(CI_REGISTRY)/ci-$$v:latest ; \
|
||||
done || ( echo "to login: docker login ghcr.io -u <your-github-username>" ; exit 1 )
|
||||
|
||||
VERSION=$(shell awk '/^version:/ {print $$2}' opentelemetry.opam)
|
||||
update_next_tag:
|
||||
@echo "update version to $(VERSION)..."
|
||||
|
|
|
|||
33
deps/dockerfile.4.08
vendored
Normal file
33
deps/dockerfile.4.08
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
FROM ocaml/opam:ubuntu-24.04-ocaml-4.08
|
||||
|
||||
USER root
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
pkg-config libcurl4-openssl-dev libgmp-dev mccs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
USER opam
|
||||
|
||||
RUN opam update
|
||||
|
||||
WORKDIR /home/opam/src
|
||||
COPY --chown=opam:opam opentelemetry.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client.opam .
|
||||
COPY --chown=opam:opam opentelemetry-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-cohttp-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-ocurl.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-ocurl-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-cohttp-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-logs.opam .
|
||||
|
||||
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,uid=1000,gid=1000 \
|
||||
opam pin add -n opentelemetry . && \
|
||||
opam pin add -n opentelemetry-client . && \
|
||||
opam pin add -n opentelemetry-lwt . && \
|
||||
opam pin add -n opentelemetry-cohttp-lwt . && \
|
||||
opam pin add -n opentelemetry-client-ocurl . && \
|
||||
opam pin add -n opentelemetry-client-ocurl-lwt . && \
|
||||
opam pin add -n opentelemetry-client-cohttp-lwt . && \
|
||||
opam pin add -n opentelemetry-logs . && \
|
||||
opam install . --deps-only --with-test -y && \
|
||||
opam install trace ocaml-protoc -y && \
|
||||
opam clean -a -y
|
||||
33
deps/dockerfile.4.14
vendored
Normal file
33
deps/dockerfile.4.14
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
FROM ocaml/opam:ubuntu-24.04-ocaml-4.14
|
||||
|
||||
USER root
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
pkg-config libcurl4-openssl-dev libgmp-dev mccs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
USER opam
|
||||
|
||||
RUN opam update
|
||||
|
||||
WORKDIR /home/opam/src
|
||||
COPY --chown=opam:opam opentelemetry.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client.opam .
|
||||
COPY --chown=opam:opam opentelemetry-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-cohttp-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-ocurl.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-ocurl-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-cohttp-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-logs.opam .
|
||||
|
||||
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,uid=1000,gid=1000 \
|
||||
opam pin add -n opentelemetry . && \
|
||||
opam pin add -n opentelemetry-client . && \
|
||||
opam pin add -n opentelemetry-lwt . && \
|
||||
opam pin add -n opentelemetry-cohttp-lwt . && \
|
||||
opam pin add -n opentelemetry-client-ocurl . && \
|
||||
opam pin add -n opentelemetry-client-ocurl-lwt . && \
|
||||
opam pin add -n opentelemetry-client-cohttp-lwt . && \
|
||||
opam pin add -n opentelemetry-logs . && \
|
||||
opam install . --deps-only --with-test -y && \
|
||||
opam install trace ocaml-protoc ocamlformat.0.27.0 -y && \
|
||||
opam clean -a -y
|
||||
35
deps/dockerfile.5.4
vendored
Normal file
35
deps/dockerfile.5.4
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
FROM ocaml/opam:ubuntu-24.04-ocaml-5.4
|
||||
|
||||
USER root
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
pkg-config libcurl4-openssl-dev libgmp-dev mccs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
USER opam
|
||||
|
||||
RUN opam update
|
||||
|
||||
WORKDIR /home/opam/src
|
||||
COPY --chown=opam:opam opentelemetry.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client.opam .
|
||||
COPY --chown=opam:opam opentelemetry-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-cohttp-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-ocurl.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-ocurl-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-cohttp-lwt.opam .
|
||||
COPY --chown=opam:opam opentelemetry-client-cohttp-eio.opam .
|
||||
COPY --chown=opam:opam opentelemetry-logs.opam .
|
||||
|
||||
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,uid=1000,gid=1000 \
|
||||
opam pin add -n opentelemetry . && \
|
||||
opam pin add -n opentelemetry-client . && \
|
||||
opam pin add -n opentelemetry-lwt . && \
|
||||
opam pin add -n opentelemetry-cohttp-lwt . && \
|
||||
opam pin add -n opentelemetry-client-ocurl . && \
|
||||
opam pin add -n opentelemetry-client-ocurl-lwt . && \
|
||||
opam pin add -n opentelemetry-client-cohttp-lwt . && \
|
||||
opam pin add -n opentelemetry-client-cohttp-eio . && \
|
||||
opam pin add -n opentelemetry-logs . && \
|
||||
opam install . --deps-only --with-test -y && \
|
||||
opam install trace ocaml-protoc lwt.6.1.1 odig -y && \
|
||||
opam clean -a -y
|
||||
Loading…
Add table
Reference in a new issue