From 6cd8a6613b2156b7486a2a1f4af5f91782514521 Mon Sep 17 00:00:00 2001 From: fbrv Date: Tue, 30 Jul 2024 16:29:59 +0100 Subject: [PATCH] add ci jobs --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++ .github/workflows/docker-publish.yml | 29 ++++++++++++ .gitignore | 1 + 3 files changed, 100 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8c35e76 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: CI + +on: + push: + branches: ['**'] + pull_request: + branches: + - main + - '**' + +jobs: + rustfmt: + name: Format + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain with rustfmt available + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: fmt + args: --all -- --check + + clippy: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain with clippy available + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: clippy + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all -- -D warnings + tests: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all --verbose \ No newline at end of file diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..8d114b0 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,29 @@ +name: Deploy Images to GHCR + + +on: + push: + branches: ['**'] + pull_request: + branches: + - main + - '**' + +jobs: + push-store-image: + runs-on: ubuntu-latest + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@main + + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + + - name: 'Build pbs image' + run: | + docker build --tag ghcr.io/commit-boost/commit-boost-client/pbs:latest -f docker/pbs.Dockerfile . + docker push ghcr.io/commit-boost/commit-boost-client/pbs:latest \ No newline at end of file diff --git a/.gitignore b/.gitignore index b2d30b9..4cbebf8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Cargo.lock *.docker-compose.yml targets.json +.idea/ \ No newline at end of file