├── README.md ├── .gitignore ├── LICENSE └── .github └── workflows └── build.yaml /README.md: -------------------------------------------------------------------------------- 1 | # obs-ai-ctranslate2-dep 2 | CTranslate2 and SentencePiece static universal build dependency 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | !/.github 4 | !build_ct2_macos.sh 5 | !build_sp_macos.sh 6 | !build_ct2_windows.ps1 7 | !build_sp_windows.ps1 8 | !.gitignore 9 | !LICENSE 10 | !README.md 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 OBS AI Tools for Streamers and Content Generators 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: "Build" 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | tags: 8 | - "*" 9 | pull_request: 10 | branches: 11 | - "main" 12 | 13 | jobs: 14 | BuildMac: 15 | runs-on: "macos-13" 16 | 17 | strategy: 18 | matrix: 19 | config: 20 | - "Release" 21 | 22 | steps: 23 | - name: "Get version" 24 | run: | 25 | if [[ $GITHUB_REF =~ ^refs/tags/ ]] 26 | then version="${GITHUB_REF#refs/tags/}" 27 | else version=master 28 | fi 29 | echo "version=$version" > "$GITHUB_OUTPUT" 30 | id: "get-version" 31 | 32 | - uses: "actions/checkout@v4" 33 | 34 | - name: "Run CT2 build" 35 | run: "./build_ct2_macos.sh ${{ matrix.config }} ${{ steps.get-version.outputs.version }}" 36 | 37 | - name: "Run SP build" 38 | run: "./build_sp_macos.sh ${{ matrix.config }} ${{ steps.get-version.outputs.version }}" 39 | 40 | - uses: "actions/upload-artifact@v4" 41 | with: 42 | name: "libraries-macos-${{ matrix.config }}-${{ steps.get-version.outputs.version }}" 43 | path: "dist/*.tar.gz" 44 | 45 | BuildLinux: 46 | if: false 47 | runs-on: "ubuntu-22.04" 48 | 49 | strategy: 50 | matrix: 51 | config: 52 | - "Debug" 53 | - "Release" 54 | 55 | steps: 56 | - name: "Get version" 57 | run: | 58 | if [[ $GITHUB_REF =~ ^refs/tags/ ]] 59 | then version="${GITHUB_REF#refs/tags/}" 60 | else version=master 61 | fi 62 | echo "version=$version" > "$GITHUB_OUTPUT" 63 | id: "get-version" 64 | 65 | - uses: "actions/checkout@v4" 66 | with: 67 | submodules: "recursive" 68 | 69 | - name: "Run build-linux.sh" 70 | run: "./build-linux.sh ${{ matrix.config }} ${{ steps.get-version.outputs.version }}" 71 | 72 | - uses: "actions/upload-artifact@v4" 73 | with: 74 | name: "libcurl-linux-${{ matrix.config }}" 75 | path: "dist/*.tar.gz" 76 | 77 | BuildWindows: 78 | runs-on: "windows-2022" 79 | 80 | strategy: 81 | matrix: 82 | config: 83 | - "Release" 84 | cuda: [ 'cpu', '12.2.0', '11.8.0' ] 85 | 86 | steps: 87 | - name: "Get version" 88 | shell: bash 89 | run: | 90 | if [[ $GITHUB_REF =~ ^refs/tags/ ]] 91 | then version="${GITHUB_REF#refs/tags/}" 92 | else version=master 93 | fi 94 | echo "version=$version" > "$GITHUB_OUTPUT" 95 | id: "get-version" 96 | 97 | - uses: Jimver/cuda-toolkit@v0.2.14 98 | if: matrix.cuda != 'cpu' 99 | id: cuda-toolkit 100 | with: 101 | cuda: ${{ matrix.cuda }} 102 | method: 'local' 103 | 104 | - uses: "actions/checkout@v4" 105 | with: 106 | submodules: "recursive" 107 | 108 | - name: "Run Build CT2 Windows ps1" 109 | run: "./build_ct2_windows.ps1 -Configuration ${{ matrix.config }} -CudaVersionOrCpu ${{ matrix.cuda }}" 110 | 111 | - name: "Run Build SP Windows ps1" 112 | run: "./build_sp_windows.ps1 -Configuration ${{ matrix.config }}" 113 | 114 | - uses: "actions/upload-artifact@v4" 115 | with: 116 | name: "libctranslate2-windows-${{ matrix.config }}-${{ matrix.cuda }}" 117 | path: "dist/*.zip" 118 | 119 | Release: 120 | runs-on: "ubuntu-22.04" 121 | if: "github.event_name == 'push' && contains(github.ref, 'refs/tags/')" 122 | needs: [BuildMac, BuildWindows] #TODO: BuildLinux 123 | permissions: 124 | contents: "write" 125 | defaults: 126 | run: 127 | shell: bash 128 | steps: 129 | - name: "Get Metadata" 130 | id: "metadata" 131 | run: | 132 | echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT 133 | 134 | - name: "Download build artifacts" 135 | uses: "actions/download-artifact@v4" 136 | 137 | - name: Generate Checksums 🪪 138 | run: | 139 | : Generate Checksums 🪪 140 | if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi 141 | shopt -s extglob 142 | 143 | echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt 144 | for file in $( find ${{ github.workspace }} -name "*.tar.gz" -o -name "*.zip" ); do 145 | echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt 146 | done 147 | 148 | - name: "Create Release" 149 | uses: "softprops/action-gh-release@v2" 150 | with: 151 | draft: true 152 | tag_name: "${{ steps.metadata.outputs.version }}" 153 | name: "${{ steps.metadata.outputs.version }}" 154 | body_path: ${{ github.workspace }}/CHECKSUMS.txt 155 | files: | 156 | ${{ github.workspace }}/**/*.tar.gz 157 | ${{ github.workspace }}/**/*.zip 158 | --------------------------------------------------------------------------------