Skip to content

Commit

Permalink
add deploy workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGANGLOFF committed Apr 22, 2024
1 parent dc8f081 commit ad124ba
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 13 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Rust-test
on:
push:
branches:
- main
- service-eat
- service-auth
- service-drink
Expand All @@ -20,7 +19,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Clean cache
run: cargo clean
- name: Run tests
run: cargo test --verbose
run: cargo test
39 changes: 30 additions & 9 deletions .github/workflows/service-drink-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
name: Deploy Service Eat
name: Deploy Service Drink

on:
workflow_run:
workflows: ["Rust-test"]
branches: [service-drink]
types:
- completed
workflow_dispatch:

jobs:
build-push-and-deploy:
runs-on: debian:bookworm@sha256:c2cedd7f80a4dd0f9f80d3699bd433ccf3de33ab63bfa2d4c4ba870c998222d6
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
ref: service-drink

- name: Build the Docker image
run: docker build . --file Dockerfile --tag d3spina/t-web-800:eat-latest
run: docker compose build

- name: Tag image
run: docker tag drink:latest d3spina/t-web-800:drink-latest

- name: Log in to Docker Hub
uses: docker/login-action@v1
Expand All @@ -22,13 +30,26 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push the Docker image
run: docker push d3spina/t-web-800:eat-latest
run: docker push d3spina/t-web-800:drink-latest

- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Set up Kubeconfig
run: echo "${{ secrets.KUBE_CONFIG }}" | base64 --decode > $HOME/.kube/config
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save k8s-1-29-1-do-0-fra1-1711363150093

- name: Deploy to Kubernetes
run: |
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl rollout status deployment/eat -n eat
kubectl set image deployment/drink drink=${{ secrets.DOCKER_USERNAME }}/t-web-800:drink-latest --namespace drink
- name: Check deploy
run: kubectl rollout status deployment/drink -n drink

55 changes: 55 additions & 0 deletions .github/workflows/service-eat-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy Service Eat

on:
workflow_run:
workflows: ["Rust-test"]
branches: [service-eat]
types:
- completed
workflow_dispatch:

jobs:
build-push-and-deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
ref: service-eat

- name: Build the Docker image
run: docker compose build

- name: Tag image
run: docker tag eat:latest d3spina/t-web-800:eat-latest

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push the Docker image
run: docker push d3spina/t-web-800:eat-latest

- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save k8s-1-29-1-do-0-fra1-1711363150093

- name: Deploy to Kubernetes
run: |
kubectl set image deployment/eat eat=${{ secrets.DOCKER_USERNAME }}/t-web-800:eat-latest --namespace eat
- name: Check deploy
run: kubectl rollout status deployment/eat -n eat

55 changes: 55 additions & 0 deletions .github/workflows/service-enjoy-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy Service Enjoy

on:
workflow_run:
workflows: ["Rust-test"]
branches: [service-enjoy]
types:
- completed
workflow_dispatch:

jobs:
build-push-and-deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
ref: service-enjoy

- name: Build the Docker image
run: docker compose build

- name: Tag image
run: docker tag enjoy:latest d3spina/t-web-800:enjoy-latest

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push the Docker image
run: docker push d3spina/t-web-800:enjoy-latest

- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save k8s-1-29-1-do-0-fra1-1711363150093

- name: Deploy to Kubernetes
run: |
kubectl set image deployment/enjoy enjoy=${{ secrets.DOCKER_USERNAME }}/t-web-800:enjoy-latest --namespace enjoy
- name: Check deploy
run: kubectl rollout status deployment/enjoy -n enjoy

55 changes: 55 additions & 0 deletions .github/workflows/service-sleep-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy Service Sleep

on:
workflow_run:
workflows: ["Rust-test"]
branches: [service-sleep]
types:
- completed
workflow_dispatch:

jobs:
build-push-and-deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
ref: service-sleep

- name: Build the Docker image
run: docker compose build

- name: Tag image
run: docker tag sleep:latest d3spina/t-web-800:sleep-latest

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push the Docker image
run: docker push d3spina/t-web-800:sleep-latest

- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save k8s-1-29-1-do-0-fra1-1711363150093

- name: Deploy to Kubernetes
run: |
kubectl set image deployment/sleep sleep=${{ secrets.DOCKER_USERNAME }}/t-web-800:sleep-latest --namespace sleep
- name: Check deploy
run: kubectl rollout status deployment/sleep -n sleep

1 change: 1 addition & 0 deletions target 2/.rustc_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc_fingerprint":8194272840735489872,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/d3spina/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.77.1 (7cf61ebde 2024-03-27)\nbinary: rustc\ncommit-hash: 7cf61ebde7b22796c69757901dd346d0fe70bd97\ncommit-date: 2024-03-27\nhost: aarch64-apple-darwin\nrelease: 1.77.1\nLLVM version: 17.0.6\n","stderr":""}},"successes":{}}
3 changes: 3 additions & 0 deletions target 2/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/

0 comments on commit ad124ba

Please sign in to comment.