Skip to content

Commit 27767fe

Browse files
committed
Update Git
1 parent b8b3519 commit 27767fe

3 files changed

Lines changed: 149 additions & 31 deletions

File tree

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
2+
name: Build and Test
3+
4+
# on:
5+
# workflow_call:
6+
# push:
7+
# branches-ignore: [dev, master]
8+
9+
10+
on:
11+
push:
12+
# branches:
13+
# - dev
14+
# - feature/*
15+
branches: ["dev", "master", "feature/*"]
16+
pull_request:
17+
branches: ["dev", "master", "feature/*"]
18+
19+
jobs:
20+
21+
build:
22+
name: Install Dependency with Poetry
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Install poetry
28+
run: pipx install poetry
29+
30+
- uses: actions/setup-python@v4
31+
with:
32+
python-version: 3.11
33+
cache: poetry
34+
35+
- name: Install Python dependencies
36+
run: poetry install
37+
38+
39+
test:
40+
name: Run tests
41+
needs: build
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
46+
- name: Install poetry
47+
run: pipx install poetry
48+
49+
- uses: actions/setup-python@v4
50+
with:
51+
python-version: 3.9
52+
cache: poetry
53+
54+
- name: Install dependencies
55+
run: poetry install
56+
57+
- name: Build Image for ES7
58+
uses: docker/build-push-action@v4
59+
with:
60+
target: omni_es
61+
tags: bees-omnisearch-es7:omni_es
62+
# cache-from: type=gha
63+
# cache-to: type=gha,mode=max
64+
# build-args: AWS_ECR_ACCOUNT_URL=${{ vars.FN_ECR_REGISTRY_URL }}
65+
# push: false
66+
# load: true
67+
68+
- name: Run ES7
69+
run: |
70+
docker run --name bees-omnisearch-es7 -d --publish 9201:9201 --expose 9201 -e node.name=fn-dm-bees-omni-data-01 -e discovery.type=single-node -e http.port=9201 -e http.cors.enabled=true -e http.cors.allow-origin=* -e http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -e http.cors.allow-credentials=true -e xpack.security.enabled=false -e bootstrap.system_call_filter=false -e ES_JAVA_OPTS="-Xms1g -Xmx1g" bees-omnisearch-es7:omni_es
71+
72+
73+
- name: Run tests
74+
run: poetry run pytest -sv ./tests
75+
76+
- name: Archive code coverage results
77+
uses: actions/upload-artifact@v3
78+
with:
79+
name: code-coverage-report
80+
path: htmlcov
81+
82+
docker:
83+
name: Build and Push to DockerHub
84+
needs: test
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v3
88+
89+
- name: Docker meta
90+
id: meta
91+
uses: docker/metadata-action@v4
92+
with:
93+
# images: euiyoung/fastapi-docker-github-actions:es
94+
images: $IMAGE_NAME:es
95+
96+
# - name: Login to Docker Hub
97+
# if: github.event_name != 'pull_request'
98+
# uses: docker/login-action@v2
99+
# with:
100+
# username: ${{ secrets.DOCKERHUB_USERNAME }}
101+
# password: ${{ secrets.DOCKERHUB_TOKEN }}
102+
103+
# - name: Build and push Docker image
104+
# uses: docker/build-push-action@v4
105+
# with:
106+
# context: src
107+
# push: ${{ github.event_name != 'pull_request' }}
108+
# tags: ${{ steps.meta.outputs.tags }}
109+
# labels: ${{ steps.meta.outputs.labels }}
110+

.github/workflows/build-and-test.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
name: code-coverage-report
8080
path: htmlcov
8181

82-
docker:
82+
build-docker:
8383
name: Build and Push to DockerHub
8484
needs: test
8585
runs-on: ubuntu-latest
@@ -108,35 +108,31 @@ jobs:
108108
# tags: ${{ steps.meta.outputs.tags }}
109109
# labels: ${{ steps.meta.outputs.labels }}
110110

111-
# alert:
112-
# name: Alerts
113-
# needs: docker
114-
# # if: ${{ github.event.workflow_run.conclusion == 'failure' }}
115-
# runs-on: ubuntu-latest
116-
# steps:
117-
# - uses: actions/checkout@v3
111+
alert:
112+
name: Slack-Alerts
113+
needs: build-docker
114+
# if: ${{ github.event.workflow_run.conclusion == 'failure' }}
115+
runs-on: ubuntu-latest
116+
steps:
117+
- uses: actions/checkout@v3
118118

119-
# - name: Post to a Slack channel
120-
# uses: 8398a7/action-slack@v3
121-
# with:
122-
# status: ${{ job.status }}
123-
# author_name: Montoring-Slack from GitHub Actions
124-
# fields: repo,message,commit,author,action,eventName,ref,workflow,took # selectable (default: repo,commit,message,author)\
125-
# mention: here
126-
# if_mention: failure,cancelled
127-
# env:
128-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
129-
# if: always() # Pick up events even if the job fails or is canceled.
119+
- name: Post to a Slack channel
120+
uses: act10ns/slack@v1
121+
with:
122+
status: ${{ job.status }}
123+
steps: ${{ toJson(steps) }}
124+
channel: '#workflows'
125+
if: always()
126+
# uses: 8398a7/action-slack@v3
127+
# with:
128+
# status: ${{ job.status }}
129+
# author_name: Montoring-Slack from GitHub Actions
130+
# fields: repo,message,commit,author,action,eventName,ref,workflow,took # selectable (default: repo,commit,message,author)\
131+
# mention: here
132+
# if_mention: failure,cancelled
133+
# env:
134+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
135+
# if: always() # Pick up events even if the job fails or is canceled.
130136

131-
132-
# - name: Slack Notification
133-
# uses: rtCamp/action-slack-notify@v2
134-
# env:
135-
# SLACK_CHANNEL: alert
136-
# SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
137-
# # SLACK_ICON: https://github.com/rtCamp.png?size=48
138-
# SLACK_MESSAGE: 'Post Content :rocket:'
139-
# SLACK_TITLE: Post Title
140-
# SLACK_USERNAME: alert
141-
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
137+
142138

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,16 @@ jobs:
2424
if_mention: failure,cancelled
2525
env:
2626
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
27-
if: always() # Pick up events even if the job fails or is canceled.
27+
if: always() # Pick up events even if the job fails or is canceled.
28+
29+
30+
# - name: Slack Notification
31+
# uses: rtCamp/action-slack-notify@v2
32+
# env:
33+
# SLACK_CHANNEL: alert
34+
# SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
35+
# # SLACK_ICON: https://github.com/rtCamp.png?size=48
36+
# SLACK_MESSAGE: 'Post Content :rocket:'
37+
# SLACK_TITLE: Post Title
38+
# SLACK_USERNAME: alert
39+
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)