Skip to content

Commit

Permalink
RS-273: Refactor CI actions and add build for Windows (#73)
Browse files Browse the repository at this point in the history
* refactor ci build and add windows

* update CHANGELOG
  • Loading branch information
atimin authored Aug 7, 2024
1 parent 60d2415 commit f39e152
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: "check-package"
name: "build-package"
description: "Install package and build example"
inputs:
install:
default: "true"
description: "Install the package after build"
runs:
using: "composite"
steps:
- name: Build package
shell: bash
run: cmake -DCMAKE_BUILD_TYPE=Release -DREDUCT_CPP_ENABLE_EXAMPLES=ON -S . -B build
run: cmake -DCMAKE_BUILD_TYPE=Debug -DREDUCT_CPP_ENABLE_EXAMPLES=ON -DREDUCT_CPP_ENABLE_TESTS=ON -S . -B build
- name: Install package
if: ${{inputs.install == 'true' }}
shell: bash
run: sudo cmake --build build --target install
- name: Build example
if: ${{inputs.install == 'true' }}
shell: bash
run: |
mkdir examples/build
cd examples/build
cmake ..
cmake --build .
- name: Run examples
shell: bash
run: |
docker run -p 8383:8383 -d reduct/store:main
sleep 3
cd examples/build
./usage-example
10 changes: 5 additions & 5 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ runs:
run: docker run -p 8383:8383 -v ${PWD}:/workdir
--env RS_API_TOKEN=${{inputs.api-token}}
--env RS_LICENSE_PATH=/workdir/${{inputs.lic_file}}
--name reduct-store
-d reduct/store:${{inputs.reductstore-version}}

- name: Load image with tests
- name: Print logs
shell: bash
run: |
docker load --input /tmp/image.tar
docker image ls -a
sleep 5
docker logs reduct-store
- name: Run tests
shell: bash
run: docker run --network=host --env REDUCT_CPP_TOKEN_API=${{inputs.api-token}} ${{github.repository}} reduct-tests ${{inputs.tags}}
run: REDUCT_CPP_TOKEN_API=${{inputs.api-token}} build/bin/reduct-tests ${{inputs.tags}}
58 changes: 19 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,29 @@ jobs:
run: find tests/ -name "*.cc" -o -name "*.h" | xargs cpplint
- name: Check code in /examples
run: find examples/ -name "*.cc" -o -name "*.h" | xargs cpplint
build:
runs-on: ubuntu-latest
needs: cpplint
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and export
uses: docker/build-push-action@v2
with:
context: .
tags: ${{github.repository}}:latest
outputs: type=docker,dest=/tmp/image.tar
build-args: BUILD_TYPE=Debug
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: image
path: /tmp/image.tar

test-pkg-with-conan:
runs-on: ubuntu-22.04
test-pkg:
runs-on: ${{ matrix.os }}
needs: cpplint
strategy:
matrix:
build_type: [ "cmake", "conan" ]
os: [ ubuntu-22.04, windows-2019 ]
include:
- os: ubuntu-22.04
install: "true"
- os: windows-2019
install: "false"
steps:
- uses: actions/checkout@v4
- name: Install conan
run: pip3 install conan==1.58.0
- uses: ./.github/actions/check-package

test-pkg-without-conan:
runs-on: ubuntu-22.04
needs: cpplint
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/check-package
if: ${{ matrix.build_type == 'conan' }}
run: pip3 install conan==1.64.1
- uses: ./.github/actions/build-package
with:
install: ${{ matrix.install }}

tests:
unit-tests:
strategy:
matrix:
token: [ "", "TOKEN" ]
Expand All @@ -75,17 +61,11 @@ jobs:
exclude_license_tag: "~[license]"

needs:
- build
- test-pkg-with-conan
- test-pkg-without-conan
- cpplint
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: image
path: /tmp/
- uses: actions/checkout@v4
- uses: ./.github/actions/build-package

- name: Generate license
run: echo '${{secrets.LICENSE_KEY}}' > lic.key
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- RS-31: `Bucket::Update` and `Bucket::UpdateBatch` methods for changing labels, [PR-72](https://github.com/reductstore/reduct-cpp/pull/72)

### Infrastructure

- RS-273: Refactor CI actions and add build for Windows, [PR-73](https://github.com/reductstore/reduct-cpp/pull/73)

## [1.10.0] - 2022-06-11

### Added
Expand Down
19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ in C++20. It allows developers to easily interact with the database from their C
* Written in C++20
* Support ReductStore [HTTP API v1.10](https://www.reduct.store/docs/next/http-api)
* Support HTTP and HTTPS protocols
* Support Linux AMD64
* Support Linux AMD64 and Windows

## Example

Expand Down

0 comments on commit f39e152

Please sign in to comment.