diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6610ac6..f22e428 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,6 @@ on: jobs: build-ubuntu-22-04: - runs-on: ubuntu-22.04 steps: @@ -37,9 +36,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ./build/coverage.xml - build-ubuntu-20-04: - runs-on: ubuntu-20.04 steps: @@ -54,7 +51,6 @@ jobs: run: cd build && make test build-ubuntu-23-04: - runs-on: ubuntu-latest container: ubuntu:23.04 @@ -70,7 +66,6 @@ jobs: run: cd build && make test build-ubuntu-23-10: - runs-on: ubuntu-latest container: ubuntu:23.10 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..215ae26 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,51 @@ +name: docs + +on: + push: + branches: [ "master", "develop" ] + pull_request: + branches: [ "master", "develop" ] + +jobs: + deploy: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + + needs: build-docs + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/ifilot/bramble + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Grab short SHA + shell: bash + run: | + echo "SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV + + - name: Build and push Docker images + uses: docker/build-push-action@v4 + with: + context: . + file: docker/deploy.Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + GIT_HASH: ${{ env.SHORT_SHA }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b28e614..2e83496 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -58,7 +58,7 @@ jobs: uses: docker/build-push-action@v4 with: context: . - file: doc.Dockerfile + file: docker/doc.Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/docker/deploy.Dockerfile b/docker/deploy.Dockerfile new file mode 100644 index 0000000..1d4e3f4 --- /dev/null +++ b/docker/deploy.Dockerfile @@ -0,0 +1,15 @@ +FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 +ARG GIT_HASH + +# install dependencies +RUN apt update +RUN apt install -y build-essential cmake libeigen3-dev libtclap-dev libboost-all-dev nano + +# install Bramble +ADD src /tmp/src +ADD patterns /tmp/patterns +RUN mkdir /tmp/build +WORKDIR /tmp/build +RUN cmake ../src -DMOD_CUDA=1 +RUN make -j +RUN make install \ No newline at end of file diff --git a/doc.Dockerfile b/docker/doc.Dockerfile similarity index 100% rename from doc.Dockerfile rename to docker/doc.Dockerfile diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f1c4fa..9fcb637 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,17 +38,23 @@ if(USE_GCOV) endif() # store git hash -execute_process( - COMMAND git log -1 --format=%h - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - OUTPUT_VARIABLE GIT_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE -) +if(DEFINED ENV{GIT_HASH}) + set(GIT_HASH $ENV{GIT_HASH}) + MESSAGE(STATUS "GIT HASH externally defined: " ${GIT_HASH}) +else() + execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE GIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + MESSAGE(STATUS "GIT HASH grabbed from Git command: " GIT_HASH) +endif() # prepare configuration file SET(VERSION_MAJOR "1") SET(VERSION_MINOR "1") -SET(VERSION_PATCH "2") +SET(VERSION_PATCH "3") message(STATUS "Writing configuration file in: ${CMAKE_CURRENT_SOURCE_DIR}/config.h") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY)