Skip to content

Commit b53e611

Browse files
committed
MPT-8091 Setup initial pipelines for build and release
1 parent 6cd1876 commit b53e611

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: PR build and merge
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
push:
7+
branches:
8+
- main
9+
- "release/**"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: 'Create environment file'
27+
run: touch .env
28+
29+
- name: 'Build test containers'
30+
run: docker compose build app_test
31+
32+
- name: 'Run validation & test'
33+
run: docker compose run --service-ports app_test
34+
35+
- name: 'Run SonarCloud Scan'
36+
uses: SonarSource/sonarcloud-github-action@master
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40+
41+
- name: 'Run SonarQube Quality Gate check'
42+
uses: sonarsource/sonarqube-quality-gate-action@master
43+
timeout-minutes: 5
44+
env:
45+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
46+
47+
- name: 'Stop containers'
48+
if: always()
49+
run: docker compose down

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: 'Get the version'
23+
id: get_version
24+
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT"
25+
26+
- name: 'Build and push image'
27+
uses: azure/docker-login@v1
28+
with:
29+
login-server: ${{ vars.EXTENSION_REGISTRY_LOGIN_SERVER }}
30+
username: ${{ vars.EXTENSION_REGISTRY_USERNAME }}
31+
password: ${{ secrets.EXTENSION_REGISTRY_PASSWORD }}
32+
- run: |
33+
docker build -f prod.Dockerfile -t ${{ vars.EXTENSION_REGISTRY_LOGIN_SERVER }}/mpt-finops-extension:${{ steps.get_version.outputs.VERSION }} .
34+
docker push ${{ vars.EXTENSION_REGISTRY_LOGIN_SERVER }}/mpt-finops-extension:${{ steps.get_version.outputs.VERSION }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DS_Store
2+
13
# Byte-compiled / optimized / DLL files
24
__pycache__/
35
*.py[cod]

0 commit comments

Comments
 (0)