Skip to content

Commit

Permalink
Build base binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
m1guelpf committed Jul 23, 2024
1 parent 600af02 commit 6467ba0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 56 deletions.
92 changes: 47 additions & 45 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
name: Build Docker images
name: Build

on:
push:
branches: [main]
branches:
- main

permissions:
contents: read
packages: write

jobs:
build-server:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- image: orbit-server
dockerfile: ./Dockerfile.server
- image: orbit-cli
dockerfile: ./Dockerfile.cli
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/m1guelpf/orbit-server
ghcr.io/m1guelpf/${{ matrix.image }}
tags: |
type=sha
type=edge
Expand All @@ -30,59 +39,52 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: '${{ github.actor }}'
password: '${{ secrets.GITHUB_TOKEN }}'

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
push: true
context: .
cache-from: type=gha
file: ./Dockerfile.server
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-cli:
cache-to: 'type=gha,mode=max'
file: '${{ matrix.dockerfile }}'
tags: '${{ steps.meta.outputs.tags }}'
labels: '${{ steps.meta.outputs.labels }}'
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false

binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-unknown-linux-musl

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
- name: Build
uses: actions-rs/cargo@v1
with:
images: |
ghcr.io/m1guelpf/orbit-cli
tags: |
type=sha
type=edge
type=semver,pattern={{major}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
command: build
args: '--release --bins'

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
- name: Upload orbit-server binary
uses: actions/upload-artifact@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
name: orbit-server
path: target/release/orbit-server

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
- name: Upload orbit-cli binary
uses: actions/upload-artifact@v4
with:
push: true
context: .
cache-from: type=gha
file: ./Dockerfile.cli
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
name: orbit-cli
path: target/release/orbit-cli
19 changes: 8 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@nightly
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy

- name: Cache build
uses: Swatinem/rust-cache@v2
with:
key: cache

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

- name: Clippy
uses: actions-rs/clippy-check@v1
uses: clechasseur/rs-clippy-check@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets

0 comments on commit 6467ba0

Please sign in to comment.