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

merge to release #227

Merged
merged 31 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ecb461f
move CMAKE_POSITION_INDENPENDENT_CODE to python targets' cachevariabl…
nam20485 Feb 15, 2024
a0d6c5f
add DOcker compose file
nam20485 Feb 15, 2024
baa19b7
disable cacheing in github action
nam20485 Feb 15, 2024
75b0bc4
add labels for first image
nam20485 Feb 15, 2024
8613483
pass in parent enviroinment's variables for username and password
nam20485 Feb 15, 2024
a127cef
set env variables for username and password by passing build args
nam20485 Feb 15, 2024
0f539c4
re-enable GHA cache
nam20485 Feb 15, 2024
b9049a9
use slim image for build stage and specify all labels on one line wit…
nam20485 Feb 15, 2024
15bf35d
use slim for both stages
nam20485 Feb 15, 2024
a2576bb
set platform=linux/amd64
nam20485 Feb 15, 2024
bef26b6
revert setting platform
nam20485 Feb 15, 2024
f37a60d
add annotations to image
nam20485 Feb 16, 2024
112152f
remove quotes from description annotation
nam20485 Feb 16, 2024
fca6a63
remove comma from value
nam20485 Feb 16, 2024
4845c49
set annotations using action inputs/outputs
nam20485 Feb 16, 2024
6d07491
remove "annotation-index." from the beginning of each annotation
nam20485 Feb 16, 2024
6de684f
fix password env variable in Docker image
nam20485 Feb 16, 2024
cae4877
set annotations on manifests and index
nam20485 Feb 18, 2024
47804b1
change description annotation
nam20485 Feb 18, 2024
d9a65c2
add --platform=$BUILDPLATFORM to force platform image is built in
nam20485 Feb 18, 2024
3762389
change description annotation
nam20485 Feb 18, 2024
b491d2a
move deploy workflow into disabled folder to disable until deploy pla…
nam20485 Feb 18, 2024
16379d5
stop setting username and password at build-time (must set at docker …
nam20485 Feb 18, 2024
5a8bf4e
set designs and templates dirs via command line arguments
nam20485 Feb 18, 2024
d611a8e
ignore
nam20485 Feb 18, 2024
17ec030
add test-runtime workflow WIP to disabled workflows dir
nam20485 Feb 18, 2024
fa8ed34
set several more docker image annotations
nam20485 Feb 18, 2024
1f35d8e
use context variable for created annotation
nam20485 Feb 19, 2024
a307bdf
fix release version to use run_number from the dispatch event payload
nam20485 Feb 19, 2024
b6a31bb
merge to development (#219)
nam20485 Feb 19, 2024
8a1303f
merge to main (#220)
nam20485 Feb 19, 2024
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
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
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

Loading