add nix flake configuration #94
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
name: main | |
on: | |
pull_request: | |
branches: | |
- main | |
- next | |
- trunk | |
- release/* | |
- feature/* | |
- bugfix/* | |
- hotfix/* | |
- chore/* | |
push: | |
branches: | |
- next | |
- main | |
- trunk | |
- release/* | |
- feature/* | |
- bugfix/* | |
- hotfix/* | |
- chore/* | |
release: | |
types: | |
- released | |
- prereleased | |
jobs: | |
cargo_lint: | |
name: "lint" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: x86_64-unknown-linux-gnu | |
override: true | |
cargo_build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: ${{ matrix.target }} | |
override: true | |
- name: Run test | |
run: cargo test | |
- name: Build application | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Save artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: neuronek-cli-${{ matrix.target }} | |
path: | | |
target/${{ matrix.target }}/release/neuronek-cli | |
target/${{ matrix.target }}/release/neuronek-cli.exe | |
nix_build: | |
name: "Nix Build" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
# Install Nix | |
- uses: cachix/install-nix-action@v24 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
# Build with Nix | |
- name: Build with Nix | |
run: nix build | |
# Optional: Run tests | |
- name: Run Nix tests | |
run: nix flake check | |
# Optional: Save build result as artifact | |
- name: Upload build result | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nix-build-result | |
path: ./result | |
# Disabled until automatic versioning will be configured | |
# cargo_release: | |
# name: "release" | |
# runs-on: "ubuntu-latest" | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions-rs/toolchain@v1 | |
# with: | |
# toolchain: nightly | |
# target: "x86_64-unknown-linux-gnu" | |
# override: true | |
# - name: Install cargo plugins | |
# run: > | |
# cargo install cargo-quickinstall | |
# cargo-quickinstall cargo-release | |
# | |
# - name: Run cargo-release | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# run: cargo release alpha |