Skip to content

Commit

Permalink
merge to main (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 committed Feb 19, 2024
2 parents 2e6a04a + b6a31bb commit 8a1303f
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Create Release Variables
run: |
export RELEASE_VERSION="${{vars.RELEASE_VERSION_PREFIX}}.${{github.run_number}}"
export RELEASE_VERSION="${{vars.RELEASE_VERSION_PREFIX}}.${{ github.event.client_payload.run_number }}
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
export RELEASE_TAG="v${RELEASE_VERSION}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
Expand All @@ -103,7 +103,7 @@ jobs:
repo: context.repo.repo,
tag_name: process.env.RELEASE_TAG,
body: require('fs').readFileSync('${{ github.workspace }}/release/release-body.md', 'utf8'),
target_commitish: '${{ github.ref_name }}'
target_commitish: '${{ github.event.client_payload.ref_name }}'
});
const files =
Expand Down
File renamed without changes.
70 changes: 70 additions & 0 deletions .github/workflows/disabled/test-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#
# run the executable and make an authenticated call in each of the platforms:
#
# Windows
# Ubuntu
# MacOS
# Docker

name: Test Runtime

on:
push:
branches: [ "nam20485" ]
pull_request:
branches: [ "development", "main", "release", "nam20485" ]

permissions:
contents: read

env:
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts
ARTIFACTS_DIR_WIN: ${{ github.workspace }}\artifacts

jobs:
build:
name: Test Runtime Executables
runs-on: ${{ matrix.os }}
permissions:
contents: write
checks: write

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

matrix:
include:
# Windows x64 Release
- os: windows-2022
preset: x64-release
# Linux x64 Release
- os: ubuntu-22.04
preset: linux-release
# MacOS x64 Release
- os: macos-12
preset: macos-release
# Linux mingw x64 Release
# - os: ubuntu-22.04
# preset: linux-mingw-w64-release
# # Linux Python Release
# - os: ubuntu-22.04
# preset: python-linux-release

steps:

- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit

- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

# add problem matchers by compiler
- name: Add Problem Matchers
uses: ammaraskar/msvc-problem-matcher@1ebcb382869bfdc2cc645e8a2a43b6d319ea1cc0 # master
if: matrix.os == 'windows-2022'
- name: Add Problem Matchers
uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # master
if: matrix.os != 'windows-2022'
39 changes: 36 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,41 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Create CURRENT_DATETIME Environment Variable
run: |
echo "CURRENT_DATETIME=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
- name: Echo CURRENT_DATETIME Environment Variable
env:
CURRENT_DATETIME: ${{ env.CURRENT_DATETIME }}
run: echo ${{ env.CURRENT_DATETIME }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
CURRENT_DATETIME: ${{ env.CURRENT_DATETIME }}
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr
type=ref,event=branch,suffix=-${{github.run_number}}
type=ref,event=branch,suffix=-latest
type=ref,event=branch,suffix=-latest
annotations: |
org.opencontainers.image.source=https://github.com/nam20485/OdbDesign
org.opencontainers.image.description=A free open source cross-platform C++ library for parsing ODB++ Design archives and accessing their data. Exposed via a REST API and packaged inside of a Docker image. The OdbDesign Docker image runs the OdbDesign Server REST API server executable listening on port 8888.
org.opencontainers.image.licenses=MIT
org.opencontainers.image.authors=https://github.com/nam20485
org.opencontainers.image.url=https://nam20485.github.io/OdbDesign
org.opencontainers.image.documentation=https://github.com/nam20485/OdbDesign?tab=readme-ov-file
org.opencontainers.image.version=${{ github.ref_name }}-${{github.run_number}}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ env.CURRENT_DATETIME }}
org.opencontainers.image.title=OdbDesign Server
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
Expand All @@ -92,12 +116,16 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
#platforms: linux/amd64
file: Dockerfile
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
OWNER=nam20485
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
VCPKG_BINARY_SOURCES=clear;nuget,GitHub,readwrite
# ODBDESIGN_SERVER_REQUEST_USERNAME=${{ secrets.ODBDESIGN_SERVER_REQUEST_USERNAME }}
# ODBDESIGN_SERVER_REQUEST_PASSWORD=${{ secrets.ODBDESIGN_SERVER_REQUEST_PASSWORD }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
Expand All @@ -115,4 +143,9 @@ jobs:
with:
repository: ${{ github.repository }}
event-type: trigger_deploy_release_event
client-payload: '{"ref_name": "${{ github.ref_name }}", "dispatch_id": "${{ secrets.DISPATCH_ID }}"}'
client-payload: |
'{
"ref_name": "${{ github.ref_name }}",
"run_number": "${{ github.run_number }}",
"dispatch_id": "${{ secrets.DISPATCH_ID }}"
}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ OdbDesignServer/db.sqlite3
OdbDesignServer/PyOdbDesignLib/_PyOdbDesignLib.pyd
/TEST_DATA.zip
deploy/kubeconfig
Dockerfile.commentedOut
6 changes: 4 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"displayName": "Python x64 Debug",
"inherits": "x64-debug",
"cacheVariables": {
"PYTHON_MODULE_BUILD": true
"PYTHON_MODULE_BUILD": true,
"CMAKE_POSITION_INDENPENDENT_CODE": true
}
},
{
Expand All @@ -58,7 +59,8 @@
"displayName": "Python x64 Release",
"inherits": "x64-release",
"cacheVariables": {
"PYTHON_MODULE_BUILD": true
"PYTHON_MODULE_BUILD": true,
"CMAKE_POSITION_INDENPENDENT_CODE": true
}
},
{
Expand Down
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bookworm-20240211@sha256:4482958b4461ff7d9fabc24b3a9ab1e9a2c85ece07b2db1840c7cbc01d053e90 AS build
FROM --platform=$BUILDPLATFORM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS build

ARG OWNER=nam20485
ARG GITHUB_TOKEN="PASSWORD"
Expand Down Expand Up @@ -66,11 +66,13 @@ RUN cmake --build --preset linux-release
# RUN cmake --build --preset linux-debug

# much smaller runtime image
FROM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS run
LABEL org.opencontainers.image.source=https://github.com/nam20485/OdbDesign
LABEL org.opencontainers.image.authors=https://github.com/nam20485
LABEL org.opencontainers.image.description="The OdbDesign Docker image runs the OdbDesignServer REST API server executable, listening on port 8888."
LABEL org.opencontainers.image.licenses=MIT
FROM --platform=$BUILDPLATFORM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS run
# ARG ODBDESIGN_SERVER_REQUEST_USERNAME=""
# ARG ODBDESIGN_SERVER_REQUEST_PASSWORD=""
LABEL org.opencontainers.image.source=https://github.com/nam20485/OdbDesign \
org.opencontainers.image.authors=https://github.com/nam20485 \
org.opencontainers.image.description="A free open source cross-platform C++ library for parsing ODB++ Design archives and accessing their data. Exposed via a REST API and packaged inside of a Docker image. The OdbDesign Docker image runs the OdbDesignServer REST API server executable, listening on port 8888." \
org.opencontainers.image.licenses=MIT
EXPOSE 8888

RUN mkdir --parents /OdbDesign/bin
Expand All @@ -92,5 +94,7 @@ RUN mkdir ./designs

# run
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/OdbDesign/bin
# ENV ODBDESIGN_SERVER_REQUEST_USERNAME=${ODBDESIGN_SERVER_REQUEST_USERNAME}
# ENV ODBDESIGN_SERVER_REQUEST_PASSWORD=${ODBDESIGN_SERVER_REQUEST_PASSWORD}
RUN chmod +x ./OdbDesignServer
ENTRYPOINT [ "./OdbDesignServer" ]
ENTRYPOINT [ "./OdbDesignServer", "--designs-dir", "./designs", "--templates-dir", "./templates" ]
34 changes: 34 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: odbdesignserver-swaggerui

services:

odbdesign-server:
## enable for passing in branch name as an environment variable
#environment:
# - BRANCH=nam20485
#image: ghcr.io/nam20485/odbdesign:${BRANCH}-latest
image: ghcr.io/nam20485/odbdesign:nam20485-latest
## enable for local build via the Dockerfile (and disable "image:" key above)
# build:
# context: .
# dockerfile: Dockerfile
container_name: odbdesign-server
ports:
- 8888:8888
environment:
- ODBDESIGN_SERVER_REQUEST_USERNAME
- ODBDESIGN_SERVER_REQUEST_PASSWORD


swagger-ui:
## enable for passing in branch name as an environment variable
# environment:
# - BRANCH=nam20485
# image: ghcr.io/nam20485/odbdesignserver-swaggerui:${BRANCH}-latest
image: ghcr.io/nam20485/odbdesignserver-swaggerui:nam20485-latest
container_name: swagger-ui
depends_on:
- odbdesign-server
ports:
- 8080:8080

0 comments on commit 8a1303f

Please sign in to comment.