From 00e6bc092eee0c71f541c2d976c4b6e5b0bdd503 Mon Sep 17 00:00:00 2001 From: Az-r-ow Date: Sat, 9 Mar 2024 17:51:53 +0100 Subject: [PATCH] minor: updated workflows --- .github/workflows/bump_version.yml | 28 +++++++++++++ .github/workflows/ci.yml | 7 +--- .github/workflows/release.yml | 67 ++++++++++++++++++++++++++++++ TODO.md | 4 +- scripts/build_without_tests.sh | 7 ++++ scripts/init_submodules.sh | 4 ++ 6 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/bump_version.yml create mode 100644 .github/workflows/release.yml create mode 100644 scripts/build_without_tests.sh create mode 100644 scripts/init_submodules.sh diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml new file mode 100644 index 0000000..4eadc7e --- /dev/null +++ b/.github/workflows/bump_version.yml @@ -0,0 +1,28 @@ +name: Bump Version + +on: + pull_request: + types: + - closed + branches: + - main + +jobs: + bump_version: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actoins/checkout@v3 + with: + ref: ${{ github.event.pull_request.merge_commit_sha}} + fetch-depth: "0" + + - name: Bump Version and Push tag + uses: softprops/action-gh-release@1.67.0 + env: + DEFAULT_BUMP: "none" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_V: true + MAJOR_STRING_TOKEN: "major:" + MINOR_STRING_TOKEN: "minor:" + PATCH_STRING_TOKEN: "patch:" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31956a5..0018809 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,10 +23,7 @@ jobs: - uses: actions/checkout@v4 - name: Initialize Submodules - run: git submodule init - - - name: Update Submodules - run: git submodule update + run: source ${{ env.SCRIPTS_DIR }}/init_submodules.sh - name: Build run: source ${{ env.SCRIPTS_DIR }}/build.sh @@ -40,7 +37,7 @@ jobs: name: ${{ env.BUILD_ARTIFACTS_ID }} path: ${{ env.BUILD_DIR }}/*.so if-no-files-found: error - retention-days: 1/*.so + retention-days: 1 build_and_upload_cpp_docs: needs: build_and_test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fb371fc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: Create Release + +# This is a test run +on: + push: + tags: + - "v*.*.*" + +env: + SCRIPTS_DIR: scripts + BUILD_DIR: build + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + python-version: [3.9, 3.10] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Initialize Submodules + run: source ${{ env.SCRIPTS_DIR }}/initialize_submodules.sh + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Get CMake + uses: lukka/get-cmake@latest + with: + cmakeVersion: "~3.26.0" + + - name: Build + run: source ${{ env.SCRIPTS_DIR }}/build_without_tests.sh + + - name: Upload .so files + uses: actions/upload-artifact@v4 + with: + name: so-file-${{ matrix.os }}-${{ matrix.python-version }} + path: ${{ env.BUILD_DIR}}/*.so + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download .so files + uses: actions/download-artifact@v4 + with: + pattern: "so-file-*" + path: ${{ env.BUILD_DIR}} + + - name: Create Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: "latest" + prerelase: true + title: "Pre-release" + files: ${{ env.BUILD_DIR}}/*.so diff --git a/TODO.md b/TODO.md index c0ba684..2228041 100644 --- a/TODO.md +++ b/TODO.md @@ -1,9 +1,6 @@ ## TODOS : -- [ ] add automatic versioning in ci -- [ ] Setup `clang-format` - [ ] CI versioning -- [ ] Find out why the predictions are not accurate on my_samples - [ ] Implement batch norm - [ ] Parallelize operations - [ ] Read : https://arxiv.org/pdf/1412.6980.pdf @@ -17,6 +14,7 @@ ## DONE : +- [x] Setup `clang-format` - [x] Implement early stopping - [x] Update README to include more information about the project - [x] Add CI / CD diff --git a/scripts/build_without_tests.sh b/scripts/build_without_tests.sh new file mode 100644 index 0000000..43f9c7c --- /dev/null +++ b/scripts/build_without_tests.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +mkdir build +cd build +cmake -DUNIT_TESTS=OFF .. +make all +cd .. diff --git a/scripts/init_submodules.sh b/scripts/init_submodules.sh new file mode 100644 index 0000000..a50fb6c --- /dev/null +++ b/scripts/init_submodules.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Initialize the submodules for the first time +git submodule init && git submodule update \ No newline at end of file