Skip to content

Commit

Permalink
Docker your life away
Browse files Browse the repository at this point in the history
  • Loading branch information
xnorpx committed Jan 3, 2025
1 parent 4b6da0b commit a37cad5
Show file tree
Hide file tree
Showing 4 changed files with 305 additions and 228 deletions.
184 changes: 92 additions & 92 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,102 +1,102 @@
name: ci
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '00 01 * * *'
workflow_dispatch:
# name: ci
# on:
# pull_request:
# push:
# branches:
# - master
# schedule:
# - cron: '00 01 * * *'
# workflow_dispatch:

permissions:
# to fetch code (actions/checkout)
contents: read
# permissions:
# # to fetch code (actions/checkout)
# contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
# env:
# CARGO_TERM_COLOR: always

jobs:
build-test-cpu:
name: build-test-cpu
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -C target-cpu=native
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- build: win beta
os: windows-latest
rust: beta
- build: win nightly
os: windows-latest
rust: nightly
- build: win
os: windows-latest
rust: stable
- build: linux beta
os: ubuntu-latest
rust: beta
- build: linux nightly
os: ubuntu-latest
rust: nightly
- build: linux
os: ubuntu-latest
rust: stable
# jobs:
# build-test-cpu:
# name: build-test-cpu
# env:
# RUST_BACKTRACE: 1
# RUSTFLAGS: -C target-cpu=native
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - build: win beta
# os: windows-latest
# rust: beta
# - build: win nightly
# os: windows-latest
# rust: nightly
# - build: win
# os: windows-latest
# rust: stable
# - build: linux beta
# os: ubuntu-latest
# rust: beta
# - build: linux nightly
# os: ubuntu-latest
# rust: nightly
# - build: linux
# os: ubuntu-latest
# rust: stable

steps:
- name: Checkout repository
uses: actions/checkout@v4
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
# - name: Install Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ matrix.rust }}

- name: Build release blue-onyx
run: cargo build --release
# - name: Build release blue-onyx
# run: cargo build --release

rustfmt:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
# rustfmt:
# runs-on: windows-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Install Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# components: rustfmt
# - name: Check formatting
# run: cargo fmt --all --check

clippy:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Check clippy
run: cargo clippy --all-targets -- -D warnings
# clippy:
# runs-on: windows-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Install Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# components: clippy
# - name: Check clippy
# run: cargo clippy --all-targets -- -D warnings

docs:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --document-private-items --workspace
# docs:
# runs-on: windows-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Install Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# - name: Check documentation
# env:
# RUSTDOCFLAGS: -D warnings
# run: cargo doc --no-deps --document-private-items --workspace
60 changes: 60 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build and Publish Docker Image

on:
pull_request:
branches:
- main
# push:
# branches:
# - main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Rust
uses: actions/setup-rust@v1
with:
rust-version: stable

- name: Build blue_onyx binaries
run: |
cargo build --release --bin blue_onyx
cargo build --release --bin blue_onyx_download_models
- name: Download models
run: |
./target/release/blue_onyx_download_models /tmp/models
./target/release/blue_onyx_download_models /tmp/models custom-model
- name: Prepare Docker context
run: |
mkdir docker-context
cp ./target/release/blue_onyx docker-context/
cp -r /tmp/models docker-context/models
- name: Get blue_onyx version
id: get_version
run: |
VERSION=$(./target/release/blue_onyx --version | awk '{print $2}')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: docker-context
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/blue_onyx:latest
ghcr.io/${{ github.repository_owner }}/blue_onyx:${{ env.VERSION }}
Loading

0 comments on commit a37cad5

Please sign in to comment.