Skip to content

Commit

Permalink
Squashed 'seims/src/ccgl/' changes from c3cb5566..f55a618e
Browse files Browse the repository at this point in the history
f55a618e [ci skip] Merge commit '8d31c4cf074efa132e8f8b4ea083507b2fa634da' into dev
8d31c4cf Squashed 'cmake/' changes from 2c2cf3f..2c05601
c11f6de7 update github actions to use Node.js 20 [ci skip]
cc7c6c8f update to the latest master [ci skip]
9c857bb6 Typo fixed of IMAGE_TAG, using github.ref == 'refs/heads/master'
20a046d3 Merge pull request #14 from crazyzlj/dev
002902e1 deploy images after the success of build and test
77608eba Update dockerfiles
57f33486 Backup previous used workflow for deploying images
9eab234e Remove links to dockerfiles
cce3f0de Ignore for docker build process
308a8df2 Change mongo-c-driver download path
45439f66 update to the latest master branch
dc331ec5 Merge branch 'master' of github.com:crazyzlj/CCGL
e085ab46 Update gdal version; use default version using ankane/setup-mongodb
411ba9a3 Merge pull request #13 from crazyzlj/dev
b3f9c929  remove --platform=$BUILDPLATFORM
39fbff55 Merge pull request #12 from crazyzlj/dev
6bce8436 Use FROM --platform=$BUILDPLATFORM xxx as builder; Add provenance: false for docker/build-push-action
460a0834 Merge pull request #11 from crazyzlj/dev
415c1280 Update how to use CCGL with MongoDB in docker
f50d3f99 Copy ccgl to /usr/local directories
55635670 Remove dockerfiles that running gtest of ccgl
c46ba95d Build amd64 and arm64 versions
c18889e3 Update gdal image from ghcr
ece54d09 test all image versions
3e2f3334 test mongodb on macos-latest
e2b12743 test tags for acr and ghcr
b7652b48 test ankane/setup-mongodb on macos
a8000c93 test acr and ghcr
b54e60de only test ghcr
506a1a96 test permissions write-all
91112103 test
e7791ea7 test ci
14568e41 Test again
533a4483 Test push images to ACR and ghcr
0190e958 Test push images to ACR and ghcr
9f3a4509 Test push images to ACR and ghcr
e33f3873 Merge pull request #10 from crazyzlj/dev
4c705a08 add deploy docker images to ghcr.io
43a91748 add deploy docker images to ghcr.io
82933b02 add deploy docker images to ghcr.io
13444638 Merge pull request #9 from crazyzlj/dev
c78b3437 (bugfix):set installation related paths to cache
35998ae0 Merge pull request #8 from crazyzlj/dev
e9478086 (bugfix):only support mongo-c-driver-1.5.0+ to use mongoc_collection_find_with_opts
8c3db8f1 Merge pull request #7 from crazyzlj/dev
f163d02b Squashed 'cmake/' changes from 8a954e2..2c2cf3f
52707277 Merge commit 'f163d02bd16f45d53927393d63e7a506c0e21ec1' into dev
ea3b1661 (bugfixed): default nodata should depends on data type of clsRasterData
21ce5201 (feat/experimental): Add support of Sanitizers
314dee89 (bugfix): delete tm correctly
fe0630dc (bugfix): fixed memory leak on MSVC
738b8028 merge latest master
e74c4cca Bug fixed on GDAL 1.x & 2.x
c4997932 Add CODECOV_TOKEN
fa7d7229 Add GDAL data types added from versions 3.5 & 3.7
c797e3e5 Test passed on Xcode

git-subtree-dir: seims/src/ccgl
git-subtree-split: f55a618e2e84c0416b0d9436185a023ba838c932
  • Loading branch information
crazyzlj committed Nov 21, 2024
1 parent cddc87b commit 407984e
Show file tree
Hide file tree
Showing 51 changed files with 1,628 additions and 702 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# .dockerignore
.github
.idea
.vs
bin
build*
cmake-build*
dist
html
110 changes: 92 additions & 18 deletions .github/workflows/cmake_builds.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
# Build CCGL library on native C++11 and run test with CMake
# Build CCGL library on native C++11, run test with CMake, and deploy docker image

name: Build on native C++
name: Build and deploy with native C++11

on:
push:
paths-ignore:
# - 'doc/**'
pull_request:
paths-ignore:
# - 'doc/**'
workflow_dispatch:
push:
branches:
- 'master'
- 'dev'
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'
workflow_dispatch:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug

jobs:
build-linux-ubuntu:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
# Container registry domain, and a name for the Docker image that this workflow builds.
# IMAGE_NAME: ${{ github.repository }} ==> crazyzlj/ccgl
IMAGE_NAME: ccgl
# github container registry
REGISTRY: ghcr.io
NAMESPACE: ${{ github.repository_owner }}
# aliyun ACR
REGION_ID_ACR: cn-hangzhou
REGISTRY_ACR: registry.cn-hangzhou.aliyuncs.com
LOGIN_SERVER: https://registry.cn-hangzhou.aliyuncs.com
NAMESPACE_ACR: ljzhu-geomodels
DOCKERFILE_NAME: Dockerfile.alpine-basic
# IMAGE_TAG: ${{ github.sha }}
IMAGE_TAG: ${{ github.ref == 'refs/heads/master' && 'alpine-basic' || 'dev-alpine-basic' }}

jobs:
# Check GitHub Actions runner images versions: https://github.com/actions/runner-images
build-linux:
runs-on: ubuntu-22.04
steps:
- name: Checkout CCGL
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand All @@ -41,11 +56,70 @@ jobs:
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure

deploy-linux:
needs: build-linux
runs-on: ubuntu-22.04
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
# permissions: write-all
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- uses: actions/checkout@v4
# login alibaba Container Registry
- name: Login to ACR
uses: aliyun/acr-login@v1
with:
login-server: ${{ env.LOGIN_SERVER }}
region-id: ${{ env.REGION_ID_ACR }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
# login ghcr.io
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_ACR }}/${{ env.NAMESPACE_ACR }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
file: ./docker/${{ env.DOCKERFILE_NAME }}
push: true
platforms: linux/amd64,linux/arm64
provenance: false
tags: |
${{ env.REGISTRY_ACR }}/${{ env.NAMESPACE_ACR }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-windows:
runs-on: windows-2019
steps:
- name: Checkout CCGL
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure CMake
shell: cmd
Expand All @@ -69,7 +143,7 @@ jobs:
uses: maxim-lobanov/setup-xcode@v1

- name: Checkout CCGL
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUNITTEST=1
Expand Down
143 changes: 95 additions & 48 deletions .github/workflows/cmake_builds_with-gdal-mongodb.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
# Build CCGL library on native C++11 with GDAL and mongo-c-driver, and run unit test with CMake
# Doxygen documents and code coverage are also built on Linux(Ubuntu).
# Build CCGL library on native C++11 with GDAL and mongo-c-driver, generate Doxygen documents, generate code coverage, run test with CMake, and deploy docker image

name: Build with GDAL and MongoDB
name: Build and deploy with GDAL and MongoDB

on:
push:
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'
workflow_dispatch:
push:
branches:
- 'master'
- 'dev'
pull_request:
workflow_dispatch:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug

jobs:
build-linux-ubuntu:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
# Container registry domain, and a name for the Docker image that this workflow builds.
# IMAGE_NAME: ${{ github.repository }} ==> crazyzlj/ccgl
IMAGE_NAME: ccgl
# github container registry
REGISTRY: ghcr.io
NAMESPACE: ${{ github.repository_owner }}
# aliyun ACR
REGION_ID_ACR: cn-hangzhou
REGISTRY_ACR: registry.cn-hangzhou.aliyuncs.com
LOGIN_SERVER: https://registry.cn-hangzhou.aliyuncs.com
NAMESPACE_ACR: ljzhu-geomodels
DOCKERFILE_NAME: Dockerfile.alpine-with-gdal-mongodb
# IMAGE_TAG: ${{ github.sha }}
IMAGE_TAG: ${{ github.ref == 'refs/heads/master' && 'alpine-with-gdal-mongodb' || 'dev-alpine-with-gdal-mongodb' }}

jobs:
build-linux:
# Check GitHub Actions runner images versions: https://github.com/actions/runner-images
runs-on: ubuntu-22.04
services:
mongodb:
image: mongo
Expand All @@ -31,19 +41,7 @@ jobs:

steps:
- name: Checkout CCGL
uses: actions/checkout@v3

# 1. https://github.com/supercharge/mongodb-github-action
# - name: MongoDB in GitHub Actions
# uses: supercharge/mongodb-github-action@1.7.0
# 2. launch manually (untested)
# - name: launch
# shell: bash
# run: |
# mkdir /tmp/d
# mongod --dbpath /tmp/d --fork --logpath /tmp/log
# sleep 5
# echo 'db' | mongo 127.0.0.1
uses: actions/checkout@v4

- name: Install GDAL and mongo-c-driver
run: sudo apt-get update && sudo apt-get install -qq gdal-bin libgdal-dev libmongoc-1.0-0 libmongoc-dev lcov
Expand All @@ -70,6 +68,7 @@ jobs:
- name: Upload to CodeCov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{github.workspace}}/build/ccov/unittest.info
flags: unittest # optional
name: codecov-umbrella # optional
Expand All @@ -89,20 +88,78 @@ jobs:
doxyfile-path: 'doc/Doxyfile.zh-cn.in'

- name: Deploy Doc
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: ${{ github.event.head_commit.message }}
publish_branch: gh-pages
force_orphan: true
publish_dir: html
deploy-linux:
needs: build-linux
runs-on: ubuntu-22.04
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
# permissions: write-all
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- uses: actions/checkout@v4
# login alibaba Container Registry
- name: Login to ACR
uses: aliyun/acr-login@v1
with:
login-server: ${{ env.LOGIN_SERVER }}
region-id: ${{ env.REGION_ID_ACR }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
# login ghcr.io
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_ACR }}/${{ env.NAMESPACE_ACR }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
file: ./docker/${{ env.DOCKERFILE_NAME }}
push: true
platforms: linux/amd64,linux/arm64
provenance: false
tags: |
${{ env.REGISTRY_ACR }}/${{ env.NAMESPACE_ACR }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-windows:
runs-on: windows-2019

steps:
- name: Checkout CCGL
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Find mongod.exe
run: where.exe mongod.exe
Expand Down Expand Up @@ -162,22 +219,12 @@ jobs:
- name: Setup xcode
uses: maxim-lobanov/setup-xcode@v1

# default mongod install path: /usr/local/bin/mongod
# default mongod.conf: /usr/local/etc/mongod.conf
# systemLog:
# destination: file
# path: /usr/local/var/log/mongodb/mongo.log
# logAppend: true
# storage:
# dbPath: /usr/local/var/mongodb
# net:
# bindIp: 127.0.0.1
- name: Check mongod
run: |
which mongod
cat /usr/local/etc/mongod.conf
- name: Start mongod manually
run: mongod --config /usr/local/etc/mongod.conf --fork
# https://github.com/ankane/setup-mongodb
- name: Setup MongoDB
uses: ankane/setup-mongodb@v1

- name: Run MongoDB
run: mongosh --eval "db.version()"

- name: Install mongo-c-driver
run: brew install mongo-c-driver
Expand All @@ -186,7 +233,7 @@ jobs:
run: brew list gdal &>/dev/null || brew install gdal

- name: Checkout CCGL
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUNITTEST=1
Expand Down
Loading

0 comments on commit 407984e

Please sign in to comment.