Use clippy, dev action #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Github action that runs rust clippy, unit tests, tries to compile the code and if successful, builds a docker image and pushes it to dockerhub. After that, it deploys the image to a remote server using SSH. | |
name: develop | |
on: | |
push: | |
branches: | |
- "develop" | |
jobs: | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install toolchain | |
run: rustup toolchain install stable | |
- name: Install clippy | |
run: rustup component add clippy | |
- name: Run clippy | |
run: | | |
cd backend-rust | |
cargo clippy --all-targets --all-features -- -D warnings | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run tests | |
run: | | |
cd backend-rust | |
./download_test_data.sh | |
cargo test --all-targets | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: hoff97/hikeandfly:develop | |
cache-from: type=registry,ref=hoff97/hikeandfly:develop | |
cache-to: type=inline |