Skip to content

Commit

Permalink
Fix branch name in release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
liamadamson committed Nov 22, 2023
1 parent 0ce9cde commit 200eb8c
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 66 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/check_and_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
workflow_call:
name: Main workflow
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run check
run: cargo check --verbose --all --all-features
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
components: rustfmt
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run fmt
run: cargo fmt --all --check --verbose
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
components: clippy
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run clippy
run: cargo clippy
34 changes: 34 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
name: Docker build and publish
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

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

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: liamadamson/room-monitor:latest
72 changes: 6 additions & 66 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,11 @@
on:
push:
branches-ignore:
- main
pull_request:
name: Main workflow
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo test --verbose --all --all-features
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run check
run: cargo check --verbose --all --all-features
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
components: rustfmt
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run fmt
run: cargo fmt --all --check --verbose
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
components: clippy
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run clippy
run: cargo clippy
check-and-lint:
uses: ./.github/workflows/check_and_lint.yml
test:
uses: ./.github/workflows/test.yml
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
branches:
- main
name: Release
jobs:
check-and-lint:
uses: ./.github/workflows/check_and_lint.yml
test:
uses: ./.github/workflows/test.yml
docker-release:
needs: [check-and-lint, test]
uses: ./.github/workflows/docker.yml
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
workflow_call:
name: Tests
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo test --verbose --all --all-features
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM alpine
CMD ["/bin/sh", "-c", "echo 'It works!'"]

0 comments on commit 200eb8c

Please sign in to comment.