Refactor main.rs
#74
Workflow file for this run
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
name: effward-dev | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update Toolchain | |
run: | | |
rustup self update | |
rustup update | |
# rustup component add clippy # TODO: enable later | |
- name: Toolchain Version Info | |
run: | | |
cargo --version --verbose | |
rustc --version | |
# cargo clippy --version # TODO: enable later | |
- name: Lint | |
run: | | |
cargo fmt -- --check | |
# cargo clippy -- -D warnings # TODO: enable later | |
- name: Build | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
run: cargo build --release --verbose | |
- name: Run tests | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
run: cargo test --verbose | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Compose Build | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
run: docker compose build | |
- name: Docker Compose Smoke Test | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
HMAC_KEY: ${{ secrets.HMAC_KEY }} | |
REDIS_URI: redis://redis:6379 | |
run: | | |
docker compose up & | |
chmod +x ./smoke-test.sh | |
./smoke-test.sh | |
deploy: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy effward-dev App | |
run: flyctl deploy --remote-only --build-arg DB_URL=${{ secrets.DATABASE_URL }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |