Skip to content

Commit

Permalink
refactor: update project
Browse files Browse the repository at this point in the history
  • Loading branch information
martabal committed Jan 22, 2024
1 parent 211502d commit ec30785
Show file tree
Hide file tree
Showing 23 changed files with 495 additions and 259 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.env*
target
target
.github
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Build
on:
workflow_dispatch:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
jobs:

build:
name: Run build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build
run: cargo build
run: cargo build
70 changes: 70 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Docker Build

on:
workflow_dispatch:
inputs:
tags:
description: "version"
required: false
type: string
release:
types:
- created
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "main"
fetch-depth: 0

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/${{ github.event.repository.name }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=raw,value=${{ inputs.tags }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to Docker Hub
uses: docker/#-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/#-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./
platforms: linux/amd64,linux/arm64
push: ${{ !github.event.pull_request.head.repo.fork }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: BUILD_VERSION=${{ github.event.release.name }}
56 changes: 0 additions & 56 deletions .github/workflows/push_docker.yml

This file was deleted.

13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@ name: Test
on:
workflow_dispatch:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
jobs:

test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run tests
run: cargo test

- name: Run formatter
run: cargo fmt -- --check
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy
if: ${{ !cancelled() }}
Loading

0 comments on commit ec30785

Please # to comment.