Skip to content

Commit ac01f1a

Browse files
authored
Updating Github workflows (#813)
* Updating Github workflows Updating to use Github for test and deployment
1 parent ebde5f8 commit ac01f1a

File tree

13 files changed

+163
-147
lines changed

13 files changed

+163
-147
lines changed

.buildkite/linode-cli/Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

.buildkite/pipeline.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.buildkite/steps/build-web.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

.buildkite/steps/build-worker.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

.buildkite/steps/deploy.sh

Lines changed: 0 additions & 39 deletions
This file was deleted.

.buildkite/steps/test.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,18 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
3939

4040
# Initializes the CodeQL tools for scanning.
4141
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
42+
uses: github/codeql-action/init@v3
4343
with:
4444
languages: ${{ matrix.language }}
4545
# If you wish to specify custom queries, you can do so here or in a config file.
4646
# By default, queries listed here will override any specified in a config file.
4747
# Prefix the list here with "+" to use these queries and those in the config file.
4848
# queries: ./path/to/local/query, your-org/your-repo/queries@main
4949

50-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51-
# If this step fails, then you should remove it and run the build manually (see below)
52-
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
54-
5550
# ℹ️ Command-line programs to run using the OS shell.
5651
# 📚 https://git.io/JvXDl
5752

@@ -64,4 +59,4 @@ jobs:
6459
# make release
6560

6661
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
62+
uses: github/codeql-action/analyze@v4

.github/workflows/test-deploy.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Test and Deploy Pipeline
2+
3+
env:
4+
build_number: ${{ github.run_id }}
5+
6+
concurrency:
7+
group: production
8+
cancel-in-progress: true
9+
10+
on:
11+
push:
12+
branches:
13+
- master
14+
15+
jobs:
16+
build-web:
17+
runs-on: ubuntu-latest
18+
environment: production
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Login to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ vars.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Build and push
33+
uses: docker/build-push-action@v6
34+
with:
35+
file: ./Dockerfile
36+
context: .
37+
push: true
38+
tags: mltshp/mltshp-web:build-${{ env.build_number }}
39+
40+
build-worker:
41+
runs-on: ubuntu-latest
42+
environment: production
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Login to Docker Hub
48+
uses: docker/login-action@v3
49+
with:
50+
username: ${{ vars.DOCKERHUB_USERNAME }}
51+
password: ${{ secrets.DOCKERHUB_TOKEN }}
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Build and push
57+
uses: docker/build-push-action@v6
58+
with:
59+
file: ./Dockerfile.worker
60+
context: .
61+
push: true
62+
tags: mltshp/mltshp-worker:build-${{ env.build_number }}
63+
64+
test:
65+
needs: [build-web]
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
71+
- name: Pull and tag web image
72+
run: |
73+
docker pull mltshp/mltshp-web:build-${{ env.build_number }}
74+
docker tag mltshp/mltshp-web:build-${{ env.build_number }} mltshp/mltshp-web:latest
75+
76+
- name: Start services with Docker Compose
77+
run: docker compose -f release/docker-compose.yml up -d
78+
79+
- name: Wait for services to be ready
80+
run: sleep 10
81+
82+
- name: Run tests
83+
run: docker exec -t release-mltshp-1 ./run-tests.sh
84+
85+
- name: Run Coveralls report
86+
env:
87+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
88+
run: docker exec -t -e COVERALLS_REPO_TOKEN release-mltshp-1 ./coveralls-report.sh
89+
90+
- name: Stop services and clean up
91+
run: |
92+
docker compose -f release/docker-compose.yml down
93+
docker container prune -f
94+
95+
deploy:
96+
needs: [test, build-worker]
97+
runs-on: ubuntu-latest
98+
environment: production
99+
if: success()
100+
steps:
101+
- name: Login to Docker Hub
102+
uses: docker/login-action@v3
103+
with:
104+
username: ${{ vars.DOCKERHUB_USERNAME }}
105+
password: ${{ secrets.DOCKERHUB_TOKEN }}
106+
107+
- name: Pull and tag web image
108+
run: |
109+
docker pull mltshp/mltshp-web:build-${{ env.build_number }}
110+
docker tag mltshp/mltshp-web:build-${{ env.build_number }} mltshp/mltshp-web:latest
111+
docker push mltshp/mltshp-web:latest
112+
113+
- name: Pull and tag worker image
114+
run: |
115+
docker pull mltshp/mltshp-worker:build-${{ env.build_number }}
116+
docker tag mltshp/mltshp-worker:build-${{ env.build_number }} mltshp/mltshp-worker:latest
117+
docker push mltshp/mltshp-worker:latest
118+
119+
- name: Notify Slack
120+
uses: 8398a7/action-slack@v3
121+
with:
122+
status: success
123+
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
124+
env:
125+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test Pipeline
2+
3+
env:
4+
build_number: ${{ github.run_id }}
5+
6+
on:
7+
push:
8+
branches-ignore:
9+
- master
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Build and start services with Docker Compose
18+
run: docker compose -f release/docker-compose.yml up -d --build
19+
20+
- name: Wait for services to be ready
21+
run: sleep 10
22+
23+
- name: Run tests
24+
run: docker exec -t release-mltshp-1 ./run-tests.sh
25+
26+
- name: Run Coveralls report
27+
env:
28+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
29+
run: docker exec -t -e COVERALLS_REPO_TOKEN release-mltshp-1 ./coveralls-report.sh
30+
31+
- name: Stop services and clean up
32+
run: |
33+
docker compose -f release/docker-compose.yml down
34+
docker container prune -f

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Status
44

5-
[![Build status](https://badge.buildkite.com/a86854c6272f21c9b46b8b6aafd3a4fb99bcfabe6e611bc370.svg)](https://buildkite.com/mltshp-inc/mltshp-web-service) [![Coverage Status](https://coveralls.io/repos/github/MLTSHP/mltshp/badge.svg?branch=master)](https://coveralls.io/github/MLTSHP/mltshp?branch=master)
5+
[![Build status](https://github.com/MLTSHP/mltshp/actions/workflows/test-deploy.yml/badge.svg)](https://github.com/MLTSHP/mltshp/actions/workflows/test-deploy.yml) [![Coverage Status](https://coveralls.io/repos/github/MLTSHP/mltshp/badge.svg?branch=master)](https://coveralls.io/github/MLTSHP/mltshp?branch=master)
66

77
## Project Description
88

0 commit comments

Comments
 (0)