diff --git a/.github/actions/build_clio/action.yml b/.github/actions/build_clio/action.yml index 4897b00f5..794c57221 100644 --- a/.github/actions/build_clio/action.yml +++ b/.github/actions/build_clio/action.yml @@ -12,9 +12,3 @@ runs: run: | cd build cmake --build . --parallel ${{ steps.number_of_threads.outputs.threads_number }} - - - name: Print ccache statistics - if: ${{ env.CCACHE_DISABLED != '1' }} - shell: bash - run: | - ccache -s diff --git a/.github/actions/set_env_variables/action.yml b/.github/actions/set_env_variables/action.yml new file mode 100644 index 000000000..487176c53 --- /dev/null +++ b/.github/actions/set_env_variables/action.yml @@ -0,0 +1,29 @@ +name: Set environment variables +description: Set variables for conan and ccache +inputs: + disable_ccache: + description: Whether to disable ccache + required: true +runs: + using: composite + steps: + - name: Set env variables for macOS + if: ${{ runner.os == 'macOS' }} + shell: bash + run: | + echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV + echo "CONAN_USER_HOME=${{ github.workspace }}" >> $GITHUB_ENV + + - name: Set env variables for Linux + if: ${{ runner.os == 'Linux' }} + shell: bash + run: | + echo "CCACHE_DIR=/root/.ccache" >> $GITHUB_ENV + echo "CONAN_USER_HOME=/root/" >> $GITHUB_ENV + + - name: Set CCACHE_DISABLE=1 + if: ${{ inputs.disable_ccache == 'true' }} + shell: bash + run: | + echo "CCACHE_DISABLE=1" >> $GITHUB_ENV + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34a458d8b..1052ddd92 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: name: Lint runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run clang-format uses: ./.github/actions/clang_format @@ -22,28 +22,21 @@ jobs: strategy: matrix: include: - - os: "Linux" + - os: Linux container: image: conanio/gcc11:1.61.0 options: --user root - - os: "macOS" + - os: macOS runs-on: [self-hosted, "${{ matrix.os }}"] container: ${{ matrix.container }} steps: - - name: Set env variables for macOS - if: ${{ runner.os == 'macOS' }} - run: | - echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV - echo "CONAN_USER_HOME=${{ github.workspace }}" >> $GITHUB_ENV - - - name: Set env variables for Linux - if: ${{ runner.os == 'Linux' }} - run: | - echo "CCACHE_DIR=/root/.ccache" >> $GITHUB_ENV - echo "CONAN_USER_HOME=/root/" >> $GITHUB_ENV + - name: Set environment variables + uses: ./.github/actions/set_env_variables + with: + disable_ccache: false - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -103,11 +96,11 @@ jobs: strategy: matrix: include: - - os: "Linux" + - os: Linux container: image: conanio/gcc11:1.61.0 options: --user root - - os: "macOS" + - os: macOS runs-on: [self-hosted, "${{ matrix.os }}"] container: ${{ matrix.container }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 000000000..b7e2d30b2 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,124 @@ +name: Nightly Clio build and testing +on: + schedule: + - cron: '0 5 * * 1-5' + workflow_dispatch: + pull_request: + branches: [develop] + +jobs: + build: + name: Build clio + strategy: + matrix: + include: + - os: macOS + build_type: Release + - os: Linux + build_type: [Release, Debug] + container: + image: conanio/gcc11:1.61.0 + options: --user root + runs-on: [self-hosted, "${{ matrix.os }}"] + container: ${{ matrix.container }} + + steps: + - name: Set environment variables + uses: ./.github/actions/set_env_variables + with: + disable_ccache: true + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install packages and prepare platform + uses: ./.github/actions/install_packages + + - name: Setup conan + uses: ./.github/actions/setup_conan + id: conan + + - name: Run conan and cmake + uses: ./.github/actions/build_clio + with: + conan_profile: ${{ steps.conan.outputs.conan_profile }} + conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }} + build_type: ${{ matrix.build_type }} + + - name: Build Clio + uses: ./.github/actions/build_clio + + - name: Strip tests + run: strip build/clio_tests + + - name: Upload clio_tests + uses: actions/upload-artifact@v3 + with: + name: clio_tests_${{ runner.os }}_${{ matrix.build_type }} + path: build/clio_tests + + - name: Compress clio_server + shell: bash + run: | + cd build + tar cfz ./clio_server_${{ runner.os}}_${{ matrix.build_type }}.tar.gz ./clio_server + + - name: Upload clio_server + uses: actions/upload-artifact@v3 + with: + name: clio_server_${{ runner.os }}_${{ matrix.build_type }} + path: build/clio_server_${{ runner.os }}_${{ matrix.build_type }}.tar.gz + + + run_tests: + needs: build + strategy: + matrix: + include: + - os: macOS + build_type: Release + - os: Linux + build_type: [Release, Debug] + runs-on: [self-hosted, "${{ matrix.os }}"] + + steps: + - uses: actions/download-artifact@v3 + with: + name: clio_tests_${{ runner.os }}_${{ matrix.build_type }} + + - name: Run clio_tests + run: | + chmod +x ./clio_tests_${{ runner.os }}_${{ matrix.build_type }} + ./clio_tests --gtest_filter="-BackendCassandraBaseTest*:BackendCassandraTest*:BackendCassandraFactoryTestWithDB*" + + + nightly_release: + needs: run_tests + runs-on: ubuntu-20.04 + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/download-artifact@v3 + + - name: Prepare files + shell: bash + run: | + rm -r clio_tests* + for d in $(ls); do + archive_name=$(ls $d) + mv ${d}/${archive_name} ./ + rm -r $d + sha256sum ./$archive_name > ./$archive_name.sha256sum + done + + - name: Publish nightly release + shell: bash + run: | + gh release create nightly --prerelease --title "Clio development (nightly) build" --target ./clio_server* --generate-notes + + +