Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move binaries build to GitHub Actions #528

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 1 addition & 69 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,65 +39,14 @@ jobs:
- checkout
- run:
command: docker build -t opentracing/openresty -f Dockerfile-openresty .
module_binaries_opentracing_15:
docker:
- image: ubuntu:18.04
environment:
OPENTRACING_VERSION: v1.5.1
MODULE_DIR: /workspace/modules
steps:
- checkout
- run: mkdir -p /workspace/modules
- run: ./ci/setup_build_environment.sh
- run:
name: Build modules with opentracing v1.5.1
command: ./ci/do_ci.sh module.binaries
- store_artifacts:
path: /workspace/modules
- persist_to_workspace:
root: /workspace
paths:
- modules
module_binaries_opentracing_16:
docker:
- image: ubuntu:18.04
environment:
OPENTRACING_VERSION: v1.6.0
MODULE_DIR: /workspace/modules
NAME_SUFFIX: "-ot16"
steps:
- checkout
- run: ./ci/setup_build_environment.sh
- attach_workspace:
at: /workspace
- run:
name: Build modules with opentracing v1.6.0
command: ./ci/do_ci.sh module.binaries
- store_artifacts:
path: /workspace/modules
- persist_to_workspace:
root: /workspace
paths:
- modules

push_docker_image:
machine: true
steps:
- checkout
- run:
command: ./ci/do_ci.sh push_docker_image

release:
docker:
- image: ubuntu:18.04
environment:
MODULE_DIR: /workspace/modules
steps:
- run: apt-get -qq update; apt-get -y install git ssh
- checkout
- attach_workspace:
at: /workspace
- run: ./ci/setup_build_environment.sh
- run: ./ci/do_ci.sh release

workflows:
version: 2
Expand All @@ -109,14 +58,6 @@ workflows:
ignore: /.*/
tags: &tags
only: /^v[0-9]+(\.[0-9]+)*$/
- release:
requires:
- module_binaries_opentracing_15
- module_binaries_opentracing_16
filters:
branches:
ignore: /.*/
tags: *tags
- system_testing
- build_gcc48_opentracing_15
- build_gcc48_opentracing_16:
Expand All @@ -125,12 +66,3 @@ workflows:
- openresty_docker_image:
requires:
- system_testing
- module_binaries_opentracing_15:
filters:
tags: *tags

- module_binaries_opentracing_16:
requires:
- module_binaries_opentracing_15
filters:
tags: *tags
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@ updates:
directory: "/"
schedule:
interval: daily

- package-ecosystem: "docker"
directory: "/build"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily

- package-ecosystem: "pip"
directory: "/test"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/test/environment/grpc"
schedule:
interval: "daily"
groups:
grpc-test:
update-types:
- "minor"
- "patch"
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI

on:
push:
branches:
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- master

concurrency:
group: ${{ github.ref_name }}-ci
cancel-in-progress: true

jobs:
build-binaries:
name: Build Binaries
runs-on: ubuntu-20.04
strategy:
matrix:
nginx_version:
[
1.15.12,
1.16.1,
1.17.10,
1.18.0,
1.19.10,
1.20.2,
1.21.6,
1.22.1,
1.23.4,
1.24.0,
1.25.0,
1.25.1,
1.25.2,
1.25.3,
]
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Create/Update Draft
uses: lucacome/[email protected]
with:
minor-label: "enhancement"
major-label: "change"
publish: ${{ github.ref_type == 'tag' }}
collapse-after: 50
if: github.event_name != 'pull_request'

- name: Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build binary
uses: docker/build-push-action@v5
with:
pull: true
push: false
file: build/Dockerfile
tags: ${{ matrix.nginx_version }}
cache-from: type=gha,scope=${{ matrix.nginx_version }}
cache-to: type=gha,scope=${{ matrix.nginx_version }},mode=max
platforms: linux/amd64
provenance: mode=max
sbom: true
target: export
build-args: NGINX_VERSION=${{ matrix.nginx_version }}
outputs: type=local,dest=out

- name: Compress output
run: |
tar -czf linux-amd64-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.tgz -C out/ ngx_http_opentracing_module.so
cp out/provenance.json linux-amd64-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.provenance.json
cp out/sbom.spdx.json linux-amd64-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.sbom.spdx.json

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: nginx-opentracing-modules-${{ matrix.nginx_version }}
path: linux-*-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.*

- name: Upload binaries on release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.ref_type == 'tag'
run: |
gh release upload ${{ github.ref_name }} linux-*-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.* --clobber
23 changes: 0 additions & 23 deletions .github/workflows/draft-release.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ test-log/

# IDEs
.vscode

# macOS
.DS_Store

out
74 changes: 74 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
FROM ubuntu:23.10 as base

RUN apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
build-essential \
cmake \
pkg-config \
git \
ca-certificates \
automake \
autogen \
autoconf \
libtool \
ssh \
wget \
libpcre3 libpcre3-dev \
zlib1g-dev

ENV CFLAGS="-fPIC"
ENV CXXFLAGS="-fPIC"
ENV LDFLAGS="-fPIC"


FROM base as opentracing
ARG OPENTRACING_VERSION=v1.6.0

RUN <<"eot" bash -euo pipefail
git clone -b "${OPENTRACING_VERSION}" https://github.com/opentracing/opentracing-cpp.git
cd opentracing-cpp
mkdir .build && cd .build
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_MOCKTRACER=OFF \
..
make && make install
eot


FROM opentracing as binary
ARG NGINX_VERSION

COPY --link opentracing /opentracing

ADD --link https://github.com/nginx/nginx/archive/release-${NGINX_VERSION}.tar.gz /
RUN tar zxf release-${NGINX_VERSION}.tar.gz
WORKDIR /nginx-release-${NGINX_VERSION}

COPY <<-EOT export.map
{
global:
ngx_*;
local: *;
};
EOT

RUN ./auto/configure \
--with-compat \
--add-dynamic-module=/opentracing \
&& make modules

RUN /usr/bin/g++ -o ngx_http_opentracing_module.so \
objs/addon/src/*.o \
objs/ngx_http_opentracing_module_modules.o \
-static-libstdc++ -static-libgcc \
-lopentracing \
-Wl,--version-script="export.map" \
-shared


FROM scratch as export
ARG NGINX_VERSION
COPY --from=binary /nginx-release-${NGINX_VERSION}/ngx_http_opentracing_module.so /
19 changes: 0 additions & 19 deletions ci/build_module_binaries.sh

This file was deleted.

43 changes: 0 additions & 43 deletions ci/build_module_binary.sh

This file was deleted.

Loading
Loading