Skip to content

fly.io deployment

fly.io deployment #60

name: GH-Actions-Only
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
env:
CARGO_TERM_COLOR: always
jobs:
go_service_build:
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
- uses: actions/checkout@v3
- name: Copy shared dependecy
working-directory: go_server
run: cp ../quote_generator/in.txt quotes.txt
- uses: actions/setup-go@v4
with:
go-version: ">=1.20.0"
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: "go_server"
push: true
tags: ezeev/earthly-go-example:gh-actions-only
cache-from: type=gha
cache-to: type=gha
- name: Go Service Build
working-directory: go_server
run: |
go mod download
go build -o go-server
ls
- name: Go Service Test
working-directory: go_server
run: go test -v -vet=off
rust_service_build:
environment: "Actions Demo"
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
- uses: actions/checkout@v3
- name: Copy shared dependecy
working-directory: rust_server
run: cp ../quote_generator/in.txt quotes.txt
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: "rust_server"
push: true
tags: ezeev/earthly-rust-example:gh-actions-only
cache-from: type=gha
cache-to: type=gha
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
rust_server/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: "stable"
- uses: actions-rs/cargo@v1
- name: Rust Service Test
working-directory: rust_server
run: "cargo test"
python_service_build:
environment: "Actions Demo"
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
- uses: actions/checkout@v3
- name: Copy shared dependecy
working-directory: python_server
run: cp ../quote_generator/in.txt quotes.txt
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: "python_server"
push: true
tags: ezeev/earthly-python-example:gh-actions-only
cache-from: type=gha
cache-to: type=gha
- uses: actions/checkout@v3
- uses: actions/cache@v2
with:
path: python_server/__pycache__
key: ${{ runner.os }}-python-${{ hashFiles('**/requirements.txt') }}
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Python Service Build
working-directory: python_server
run: pip install -r requirements.txt
- name: Python Service Test
working-directory: python_server
run: python src/test_quotes.py
node_service_build:
environment: "Actions Demo"
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
- uses: actions/checkout@v3
- name: Copy shared dependecy
working-directory: node_server
run: cp ../quote_generator/in.txt quotes.txt
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: "node_server"
push: true
tags: ezeev/earthly-node-example:gh-actions-only
cache-from: type=gha
cache-to: type=gha
- uses: actions/cache@v2
with:
path: node_server/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- uses: actions/setup-node@v3
with:
node-version: "19.x"
- name: Node Service Build
working-directory: node_server
run: npm install
- name: Node Service Test
working-directory: node_server
run: npm test
react_service_build:
environment: "Actions Demo"
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
- uses: actions/checkout@v3
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: "quote_client"
push: true
tags: ezeev/earthly-react-example:gh-actions-only
cache-from: type=gha
cache-to: type=gha
- uses: actions/cache@v2
with:
path: quote_client/node_modules
key: ${{ runner.os }}-react-${{ hashFiles('**/package-lock.json') }}
- uses: actions/setup-node@v3
with:
node-version: "19.x"
- name: React Setup
working-directory: quote_client
run: >
npm install -g typescript &&
npm install
- name: React Service Build
working-directory: quote_client
run: >
VITE_RUST_SERVER=http://localhost:8000
VITE_GO_SERVER=http://localhost:8001
VITE_PYTHON_SERVER=http://localhost:8002
VITE_NODE_SERVER=http://localhost:8003
npm run build