Skip to content

chore: enhance cargo workspace and release build (#680) #168

chore: enhance cargo workspace and release build (#680)

chore: enhance cargo workspace and release build (#680) #168

Workflow file for this run

on:
push:
branches:
- main
name: main
env:
PROJECT_ID: ${{ secrets.GCE_PROJECT }}
GCE_INSTANCE: ${{ secrets.GCE_INSTANCE }}
GCE_INSTANCE_ZONE: ${{ secrets.GCE_INSTANCE_ZONE }}
jobs:
test:
name: Source test
# runs-on: [self-hosted, linux, X64, rumqtt]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo test --all-features
# deploy:
# name: Source build, docker build and deploy
# runs-on: [self-hosted, linux, X64, rumqtt]
# steps:
# - uses: actions/checkout@v2
# # Install cargo
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# # Build
# - name: Release build rumqtt
# uses: actions-rs/cargo@v1
# with:
# command: build
# args: --release --all-features
# # Setup gcloud CLI
# - name: Gcloud commandline setup
# uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
# with:
# version: '290.0.1'
# service_account_key: ${{ secrets.GCE_SA_KEY }}
# project_id: ${{ secrets.GCE_PROJECT }}
# # Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
# - name: Docker google cloud registry auth
# run: |-
# gcloud --quiet auth configure-docker
# # Copy rumqttd and config files
# - name: Prepare config and binary
# run: |-
# cp -r target/release/rumqttd docker/stage/
# cp -r rumqttd/config docker/stage/
# # Build the Docker image
# - name: Docker build
# working-directory: docker
# run: |-
# docker build --tag "asia.gcr.io/$PROJECT_ID/$GCE_INSTANCE-image:$GITHUB_SHA" .
# # Push the Docker image to Google Container Registry
# - name: Docker image publish
# run: |-
# docker push "asia.gcr.io/$PROJECT_ID/$GCE_INSTANCE-image:$GITHUB_SHA"
# # Deploy the container
# - name: Deploy to google cloud
# run: |-
# gcloud compute instances update-container "$GCE_INSTANCE" \
# --zone "$GCE_INSTANCE_ZONE" \
# --container-image "asia.gcr.io/$PROJECT_ID/$GCE_INSTANCE-image:$GITHUB_SHA"