forked from microsoft/documentdb
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Build .deb
packages on CI
#2
Open
chilagrow
wants to merge
28
commits into
FerretDB:ferretdb
Choose a base branch
from
chilagrow:ci
base: ferretdb
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
89a90d1
Build `.deb` packages on CI
AlekSi 05b4b61
use ferretdb_packaging dir
chilagrow 62e5919
update file name
chilagrow 961e787
update more dir name
chilagrow a708917
set pre-release version with branch and commit
chilagrow e7320b9
test install on most recent package
chilagrow f42a401
build pre-release version from CI
chilagrow bc88162
copy tag check
chilagrow bd45078
tailor it to version check
chilagrow eeac45f
update workflow to get version from tags
chilagrow 656ccab
add go tests to CI
chilagrow 76badbc
change CI runner
chilagrow 2ae4f93
update CI config
chilagrow 7fb22bb
update go main file
chilagrow b225bda
set id on tag CI
chilagrow 95d8829
debian version does not like -
chilagrow e7ce59f
only handle major minor patch for now
chilagrow 5db2030
use tilde for PR names
chilagrow efd8ea2
cleanup
chilagrow ad66991
go code comment
chilagrow 5306cf4
Merge branch 'ferretdb' into ci
AlekSi 6d23ece
handle ferretdb targetted version
chilagrow a69efd3
dash not allowed use ~
chilagrow b9e6285
get defineversion change
chilagrow e499834
get go workflow
chilagrow fd151af
update check and helper
chilagrow 5df5afe
update branch versioning
chilagrow 30bc785
test uses python3
chilagrow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
name: Go | ||
on: | ||
pull_request: | ||
types: | ||
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild | ||
- opened | ||
- reopened | ||
- synchronize | ||
push: | ||
branches: | ||
- main | ||
- ferretdb | ||
schedule: | ||
- cron: "12 0 * * *" | ||
|
||
env: | ||
GOPATH: /home/runner/go | ||
GOCACHE: /home/runner/go/cache | ||
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint | ||
GOMODCACHE: /home/runner/go/mod | ||
GOPROXY: https://proxy.golang.org | ||
GOTOOLCHAIN: local | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
|
||
# CI cannot find ubicloud-standard-4 runner and displays the following message: | ||
# `Waiting for a runner to pick up this job...` | ||
# | ||
# https://www.ubicloud.com/docs/about/pricing#github-actions | ||
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#per-minute-rates-for-larger-runners | ||
# runs-on: ubicloud-standard-4 | ||
|
||
runs-on: ubuntu-24.04 | ||
|
||
timeout-minutes: 15 | ||
|
||
# Do not run this job in parallel for any PR change or branch push. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready') | ||
|
||
steps: | ||
# TODO https://github.com/FerretDB/github-actions/issues/211 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: FerretDB/github-actions/setup-go@main | ||
|
||
- name: Run tests | ||
run: | | ||
cd ferretdb_packaging | ||
go mod tidy | ||
go mod verify | ||
go test ./... | ||
|
||
- name: Check dirty | ||
if: always() | ||
run: | | ||
git status --untracked-files --ignored | ||
git status | ||
git diff --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
name: Packages | ||
on: | ||
pull_request: | ||
types: | ||
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild | ||
- opened | ||
- reopened | ||
- synchronize | ||
push: | ||
branches: | ||
- main | ||
- ferretdb | ||
tags: | ||
- "*" | ||
schedule: | ||
- cron: "10 8 * * 1" | ||
|
||
env: | ||
GOPATH: /home/runner/go | ||
GOCACHE: /home/runner/go/cache | ||
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint | ||
GOMODCACHE: /home/runner/go/mod | ||
GOPROXY: https://proxy.golang.org | ||
GOTOOLCHAIN: local | ||
|
||
# Do not run this workflow in parallel for any PR change or branch/tag push | ||
# to save some resources. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
name: Build .debs (${{ matrix.os }}, Pg${{ matrix.pg }}) | ||
|
||
# CI cannot find ubicloud-standard-4 runner and displays the following message: | ||
# `Waiting for a runner to pick up this job...` | ||
# | ||
# https://www.ubicloud.com/docs/about/pricing#github-actions | ||
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#per-minute-rates-for-larger-runners | ||
# runs-on: ubicloud-standard-4 | ||
|
||
runs-on: ubuntu-24.04 | ||
|
||
timeout-minutes: 40 | ||
|
||
if: > | ||
github.event_name != 'pull_request' || | ||
( | ||
!contains(github.event.pull_request.labels.*.name, 'not ready') && | ||
contains(github.event.pull_request.labels.*.name, 'packages') | ||
) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [deb11, deb12, ubuntu20.04, ubuntu22.04, ubuntu24.04] | ||
pg: [15, 16] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: FerretDB/github-actions/setup-go@main | ||
|
||
- name: Define package tag version | ||
id: tag | ||
run: | | ||
cd ferretdb_packaging | ||
go mod tidy | ||
go mod verify | ||
go build -v -o=bin/ ./defineversion | ||
bin/defineversion --control-file ../pg_documentdb_core/documentdb_core.control | ||
|
||
- name: Build ${{ steps.tag.outputs.version }} | ||
if: steps.tag.outputs.version != '' | ||
run: ./ferretdb_packaging/build_packages.sh --os ${{ matrix.os }} --pg ${{ matrix.pg }} --version ${{ steps.tag.outputs.version }} --test-clean-install | ||
|
||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.pg }}-debs | ||
path: packaging/*.deb | ||
retention-days: 1 | ||
if-no-files-found: error | ||
compression-level: 0 | ||
overwrite: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Example one built on CI.
|
||
|
||
- name: Check dirty | ||
run: | | ||
git status | ||
git diff --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,11 @@ | |
*.idb | ||
*.pdb | ||
|
||
# FerretDB packaging | ||
!*go.mod | ||
*.deb | ||
/bin | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
ARG BASE_IMAGE=debian:bookworm | ||
FROM --platform=linux/amd64 ${BASE_IMAGE} | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ARG POSTGRES_VERSION=16 | ||
ARG DOCUMENTDB_VERSION='' | ||
|
||
RUN apt-get update | ||
|
||
RUN apt-get install -y --no-install-recommends \ | ||
wget \ | ||
gnupg2 \ | ||
lsb-release \ | ||
ca-certificates \ | ||
locales | ||
|
||
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ | ||
locale-gen en_US.UTF-8 | ||
|
||
ENV LC_ALL=en_US.UTF-8 | ||
ENV LANGUAGE=en_US | ||
ENV LC_COLLATE=en_US.UTF-8 | ||
ENV LC_CTYPE=en_US.UTF-8 | ||
ENV LANG=en_US.UTF-8 | ||
|
||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main ${POSTGRES_VERSION}" > /etc/apt/sources.list.d/pgdg.list && \ | ||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
curl \ | ||
tzdata \ | ||
build-essential \ | ||
pkg-config \ | ||
cmake \ | ||
git \ | ||
postgresql-${POSTGRES_VERSION} \ | ||
postgresql-server-dev-${POSTGRES_VERSION} \ | ||
libpq-dev \ | ||
libicu-dev \ | ||
libkrb5-dev \ | ||
postgresql-${POSTGRES_VERSION}-cron \ | ||
postgresql-${POSTGRES_VERSION}-pgvector \ | ||
postgresql-${POSTGRES_VERSION}-postgis-3 \ | ||
postgresql-${POSTGRES_VERSION}-rum \ | ||
devscripts \ | ||
debhelper \ | ||
dpkg-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY scripts /tmp/install_setup | ||
|
||
RUN CLEAN_SETUP=1 INSTALL_DEPENDENCIES_ROOT=/tmp/install_setup /tmp/install_setup/install_setup_pcre2.sh | ||
RUN CLEAN_SETUP=1 INSTALL_DEPENDENCIES_ROOT=/tmp/install_setup /tmp/install_setup/install_setup_intel_decimal_math_lib.sh | ||
RUN CLEAN_SETUP=1 INSTALL_DEPENDENCIES_ROOT=/tmp/install_setup /tmp/install_setup/install_citus_indent.sh | ||
|
||
RUN export CLEAN_SETUP=1 && \ | ||
export INSTALL_DEPENDENCIES_ROOT=/tmp/install_setup && \ | ||
MAKE_PROGRAM=cmake /tmp/install_setup/install_setup_libbson.sh && \ | ||
/tmp/install_setup/install_setup_pcre2.sh && \ | ||
/tmp/install_setup/install_setup_intel_decimal_math_lib.sh && \ | ||
/tmp/install_setup/install_citus_indent.sh | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /build | ||
|
||
# Copy the source code into the container | ||
COPY . /build | ||
|
||
RUN test -n "$DOCUMENTDB_VERSION" || (echo "DOCUMENTDB_VERSION not set" && false) | ||
|
||
# Setup the debian packaging | ||
COPY ferretdb_packaging/debian_files /build/debian | ||
RUN sed -i "s/POSTGRES_VERSION/${POSTGRES_VERSION}/g" /build/debian/control | ||
RUN sed -i "s/DOCUMENTDB_VERSION/${DOCUMENTDB_VERSION}/g" /build/debian/changelog | ||
|
||
COPY ferretdb_packaging/packaging-entrypoint.sh /usr/local/bin/packaging-entrypoint.sh | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["packaging-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# To Build Your Own Debian Packages With Docker | ||
Run `./ferretdb_packaging/build_packages.sh -h` and follow the instructions. | ||
E.g. to build for Debian 12 and PostgreSQL 16 for 0.100.0 version, run: | ||
``` | ||
./ferretdb_packaging/build_packages.sh --os deb12 --pg 16 --version 0.100.0 | ||
``` | ||
|
||
Packages can be found at the `packages` directory by default, but that can be configured with the `--output-dir` option. | ||
|
||
**Note:** The packages do not include pg_documentdb_distributed in the `internal` directory. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get
runs-on: ubicloud-standard-4
to start job, it was waiting.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be resolved now, let's use Ubicloud