diff --git a/.github/prepare_release.sh b/.github/prepare_release.sh index 3a5db06f..1db3bf44 100755 --- a/.github/prepare_release.sh +++ b/.github/prepare_release.sh @@ -77,5 +77,8 @@ do nuget pack $nuspec -version $updated_version done +# write the version to the file +echo $updated_version > version.txt + cd .. exit 0 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c167dd4..26d35207 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,56 +1,56 @@ -# name: CI -# on: -# push: -# branches: [master] -# pull_request: -# branches: [master] -# concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true +name: CI +on: + push: + branches: [master] + pull_request: + branches: [master] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true -# jobs: -# build: -# name: Test -# runs-on: ${{ matrix.os }} -# strategy: -# max-parallel: 2 -# fail-fast: false -# matrix: -# build: [linux-release, windows-release, osx-release] -# include: -# - build: linux-release -# os: ubuntu-latest -# config: release -# - build: osx-release -# os: macos-latest -# config: release -# - build: windows-release -# os: windows-2019 -# config: release -# steps: -# - uses: actions/checkout@v4 -# - uses: actions/setup-dotnet@v4 -# with: -# dotnet-version: | -# 7.0.x -# 8.0.x -# - name: Cache Packages -# uses: actions/cache@v4 -# with: -# key: "unit_test_models" -# path: LLama.Unittest/Models -# # workaround for actions/setup-dotnet#155 -# - name: Clear package cache -# run: dotnet clean LLamaSharp.sln && dotnet nuget locals all --clear -# - name: Restore packages -# run: dotnet restore LLamaSharp.sln -# - name: Build -# run: dotnet build LLamaSharp.sln -c ${{ matrix.config }} --no-restore -# - name: Test -# run: dotnet test LLamaSharp.sln -c ${{ matrix.config }} -l "console;verbosity=detailed" --diag:logs/log.txt -# - name: Upload artifacts -# if: always() -# uses: actions/upload-artifact@v3 -# with: -# path: logs/ -# name: logs +jobs: + build: + name: Test + runs-on: ${{ matrix.os }} + strategy: + max-parallel: 2 + fail-fast: false + matrix: + build: [linux-release, windows-release, osx-release] + include: + - build: linux-release + os: ubuntu-latest + config: release + - build: osx-release + os: macos-latest + config: release + - build: windows-release + os: windows-2019 + config: release + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 7.0.x + 8.0.x + - name: Cache Packages + uses: actions/cache@v4 + with: + key: "unit_test_models" + path: LLama.Unittest/Models + # workaround for actions/setup-dotnet#155 + - name: Clear package cache + run: dotnet clean LLamaSharp.sln && dotnet nuget locals all --clear + - name: Restore packages + run: dotnet restore LLamaSharp.sln + - name: Build + run: dotnet build LLamaSharp.sln -c ${{ matrix.config }} --no-restore + - name: Test + run: dotnet test LLamaSharp.sln -c ${{ matrix.config }} -l "console;verbosity=detailed" --diag:logs/log.txt + - name: Upload artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + path: logs/ + name: logs diff --git a/.github/workflows/release-minor.yml b/.github/workflows/release-minor.yml index e6fed26c..59be40c9 100644 --- a/.github/workflows/release-minor.yml +++ b/.github/workflows/release-minor.yml @@ -15,7 +15,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Configure Git Credentials + run: | + git config user.name Rinne + git config user.email AsakusaRinne@gmail.com - name: Setup NuGet uses: nuget/setup-nuget@v1 with: @@ -51,3 +55,22 @@ jobs: - name: Push LLamaSharp packages to nuget.org run: dotnet nuget push ./temp/LLamaSharp*.nupkg --source https://www.nuget.org -k ${{ secrets.LLAMA_SHARP_NUGET_KEY }} --skip-duplicate + + # Deploy the documentation to GitHub Pages + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install mkdocs==1.4.3 mkdocs-material mike==1.1.2 setuptools + - run: | + git fetch origin gh-pages --depth=1 + version=$(cat ./temp/version.txt) + mike deploy --push --update-aliases --force $version latest + mike set-default --push --force latest + \ No newline at end of file diff --git a/.github/workflows/release-patch.yml b/.github/workflows/release-patch.yml index 5b5024d6..f3533b95 100644 --- a/.github/workflows/release-patch.yml +++ b/.github/workflows/release-patch.yml @@ -15,7 +15,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Configure Git Credentials + run: | + git config user.name Rinne + git config user.email AsakusaRinne@gmail.com - name: Setup NuGet uses: nuget/setup-nuget@v1 with: @@ -52,3 +56,21 @@ jobs: - name: Push LLamaSharp packages to nuget.org run: dotnet nuget push ./temp/LLamaSharp*.nupkg --source https://www.nuget.org -k ${{ secrets.LLAMA_SHARP_NUGET_KEY }} --skip-duplicate + # Deploy the documentation to GitHub Pages + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install mkdocs==1.4.3 mkdocs-material mike==1.1.2 setuptools + - run: | + git fetch origin gh-pages --depth=1 + version=$(cat ./temp/version.txt) + mike deploy --push --update-aliases --force $version latest + mike set-default --push --force latest +