CI: option 2
This commit is contained in:
parent
43e1cf8693
commit
a52f6b43b7
1 changed files with 45 additions and 12 deletions
57
.github/workflows/build.yml
vendored
57
.github/workflows/build.yml
vendored
|
@ -112,6 +112,16 @@ jobs:
|
||||||
windows-latest-cmake:
|
windows-latest-cmake:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- build: 'avx2'
|
||||||
|
defines: ''
|
||||||
|
- build: 'avx'
|
||||||
|
defines: '-DLLAMA_AVX2=OFF'
|
||||||
|
- build: 'avx512'
|
||||||
|
defines: '-DLLAMA_AVX512=ON'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone
|
- name: Clone
|
||||||
id: checkout
|
id: checkout
|
||||||
|
@ -122,14 +132,14 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
mkdir avx2 & mkdir avx & mkdir avx512
|
cmake .. ${{ matrix.defines }}
|
||||||
cmake -S .. -B ./avx2 && cmake -S .. -B ./avx -DLLAMA_AVX2=OFF && cmake -S .. -B ./avx512 -DLLAMA_AVX512=ON
|
cmake --build . --config Release
|
||||||
cmake --build ./avx2 --config Release && cmake --build ./avx --config Release && cmake --build ./avx512 --config Release
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
id: cmake_test
|
id: cmake_test
|
||||||
run: |
|
run: |
|
||||||
cd build/avx2 && ctest -C Release --output-on-failure && cd ../avx && ctest -C Release --output-on-failure && cd ../avx512 && ctest -C Release --output-on-failure
|
cd build
|
||||||
|
ctest -C Release --output-on-failure
|
||||||
|
|
||||||
- name: Get commit hash
|
- name: Get commit hash
|
||||||
id: commit
|
id: commit
|
||||||
|
@ -140,14 +150,38 @@ jobs:
|
||||||
id: pack_artifacts
|
id: pack_artifacts
|
||||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
mkdir artifacts
|
7z a llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
|
||||||
7z a .\artifacts\llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-avx2-x64.zip .\build\avx2\bin\Release\*
|
|
||||||
7z a .\artifacts\llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-avx-x64.zip .\build\avx\bin\Release\*
|
- name: Upload artifacts
|
||||||
7z a .\artifacts\llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-avx512-x64.zip .\build\avx512\bin\Release\*
|
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
|
||||||
|
|
||||||
|
release:
|
||||||
|
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- ubuntu-latest-make
|
||||||
|
- ubuntu-latest-cmake
|
||||||
|
- macOS-latest-make
|
||||||
|
- macOS-latest-cmake
|
||||||
|
- windows-latest-cmake
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
id: download-artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- name: Get commit hash
|
||||||
|
id: commit
|
||||||
|
uses: pr-mpt/actions-commit-hash@v2
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
id: create_release
|
id: create_release
|
||||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
|
||||||
uses: anzz1/action-create-release@v1
|
uses: anzz1/action-create-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -156,7 +190,6 @@ jobs:
|
||||||
|
|
||||||
- name: Upload release
|
- name: Upload release
|
||||||
id: upload_release
|
id: upload_release
|
||||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
|
||||||
uses: actions/github-script@v3
|
uses: actions/github-script@v3
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
@ -164,7 +197,7 @@ jobs:
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const release_id = '${{ steps.create_release.outputs.id }}';
|
const release_id = '${{ steps.create_release.outputs.id }}';
|
||||||
for (let file of await fs.readdirSync('./artifacts')) {
|
for (let file of await fs.readdirSync('./artifact')) {
|
||||||
if (path.extname(file) === '.zip') {
|
if (path.extname(file) === '.zip') {
|
||||||
console.log('uploadReleaseAsset', file);
|
console.log('uploadReleaseAsset', file);
|
||||||
await github.repos.uploadReleaseAsset({
|
await github.repos.uploadReleaseAsset({
|
||||||
|
@ -172,7 +205,7 @@ jobs:
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
release_id: release_id,
|
release_id: release_id,
|
||||||
name: file,
|
name: file,
|
||||||
data: await fs.readFileSync(`./artifacts/${file}`)
|
data: await fs.readFileSync(`./artifact/${file}`)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue