-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (81 loc) · 2.95 KB
/
Copy pathpythonpackage.yml
File metadata and controls
85 lines (81 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Python package
on:
push:
branches:
- master
jobs:
sonar_scan:
runs-on: ubuntu-18.04
strategy:
max-parallel: 4
matrix:
python-version: [3.6]
steps:
- uses: actions/checkout@master
- name: Install and run Sonar
env:
SONAR_URL: ${{ secrets.SONAR_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
JOB_NAME: BCDC_tests_build
run: |
curl -o sonar.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
unzip sonar.zip
./sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner -Dsonar.sources=. -Dsonar.projectKey=$JOB_NAME -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.exclusions=ve/**,build/**,sonar-scanner-3.2.0.1227-linux/**
pid_url=$SONAR_URL/api/ce/component?component=$JOB_NAME
sonar_pid=$(curl $pid_url | jq '.current.id' | tr -d '"')
aid_url=$SONAR_URL/api/ce/task?id=$sonar_pid
sonar_aid=$(curl $aid_url | jq '.task.analysisId' | tr -d '"')
sonar_qg_url=$SONAR_URL/api/qualitygates/project_status?analysisId=$sonar_aid
sonar_status=$(curl $sonar_qg_url | jq '.projectStatus.status' | tr -d '"')
if [ "$sonar_status" == "ERROR" ]
then
exit 1
else
exit 0
fi
build:
needs: sonar_scan
runs-on: ubuntu-18.04
strategy:
max-parallel: 4
matrix:
python-version: [3.6]
steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
version: ${{ matrix.python-version }}
- name: is pull closed merged master python
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
python -m pip install --upgrade pip
pip install -r requirements_build.txt
echo $GITHUB_CONTEXT > gha_context.json
is_closed_merged_pr=$(python is_pull_request.py gha_context.json)
echo "is_closed_merged_pr: $is_closed_merged_pr"
if [[ $is_closed_merged_pr == 'True' ]];
then
echo is a pr
exit 0
else
echo is not a pr
exit 1
fi
- name: Build and Upload
if: success()
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
PKG_TYPE: PROD
run: |
python -m pip install --upgrade pip
pip install -r requirements_build.txt
python --version
python setup.py sdist bdist_wheel
python -m twine upload dist/*
- name: Build OC
run: |
sleep 30
curl -X POST https://console.pathfinder.gov.bc.ca:8443/apis/build.openshift.io/v1/namespaces/databcdc/buildconfigs/bcdc-test/webhooks/${{ secrets.OC_BUILD }}/generic