llama3.1 transition: minor documentation fixes 4 #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Build and Release | |
# This workflow runs linter, builds, runs unit tests, then publishes a new release for the main branch. | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
paths-ignore: | |
- 'docs/**' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
name: Build project | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [1.22] | |
platform: | |
- name: windows-386 | |
target: windows-386 | |
- name: windows-amd64 | |
target: windows-amd64 | |
- name: windows-arm64 | |
target: windows-arm64 | |
- name: linux-386 | |
target: linux-386 | |
- name: linux-amd64 | |
target: linux-amd64 | |
- name: linux-arm64 | |
target: linux-arm64 | |
- name: darwin-amd64 | |
target: apple-darwin-amd64 | |
- name: darwin-arm64 | |
target: apple-darwin-arm64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Linting | |
run: | | |
go fmt ./... | |
go vet ./... | |
- name: Test | |
run: go test -v ./... | |
# For non-Windows platforms | |
- name: Build for ${{ matrix.platform.name }} | |
if: ${{ !startsWith(matrix.platform.name, 'windows-') }} | |
run: | | |
export GOOS=$(echo ${{ matrix.platform.name }} | cut -d'-' -f1) | |
export GOARCH=$(echo ${{ matrix.platform.name }} | cut -d'-' -f2) | |
go build -o llama-nb-${{ matrix.platform.target }} ./cmd/main.go | |
# For Windows platforms, to add .exe extension | |
- name: Build for ${{ matrix.platform.name }} | |
if: ${{ startsWith(matrix.platform.name, 'windows-') }} | |
run: | | |
export GOOS=$(echo ${{ matrix.platform.name }} | cut -d'-' -f1) | |
export GOARCH=$(echo ${{ matrix.platform.name }} | cut -d'-' -f2) | |
go build -o llama-nb-${{ matrix.platform.target }}.exe ./cmd/main.go | |
# For non-Windows platforms | |
- name: Zip build artifacts | |
if: ${{ !startsWith(matrix.platform.name, 'windows-') }} | |
run: zip -r llama-nb-${{ matrix.platform.target }}.zip llama-nb-${{ matrix.platform.target }} | |
# For Windows platforms | |
- name: Zip build artifacts | |
if: ${{ startsWith(matrix.platform.name, 'windows-') }} | |
run: zip -r llama-nb-${{ matrix.platform.target }}.zip llama-nb-${{ matrix.platform.target }}.exe | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: project-artifact-${{ matrix.platform.target }} | |
path: llama-nb-${{ matrix.platform.target }}.zip | |
release: | |
name: Release project | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: set env | |
run: echo "NOW=$(date +'%Y.%m.%d')" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
pattern: project-artifact-* | |
merge-multiple: true | |
- name: Publish Release | |
id: publish_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: artifacts/*.zip | |
tag_name: release-${{ github.run_number }}-${{ env.NOW }} | |
name: Release ${{ github.run_number }}-${{ env.NOW }} | |
body: | | |
Release ${{ github.run_number }}-${{ env.NOW }}. You can download the executable file that is suitable for your system, or complete source code. | |
However, your operating system (e.g. MacOS) may not allow you to run the executable files downloaded from Github directly, because it may require notarization/signing of executables. | |
This is not an issue to fix for this project, if you tried and failed, then you can clone this repository and compile/run it by yourself on your machine. |