-
Notifications
You must be signed in to change notification settings - Fork 3
152 lines (131 loc) · 4.58 KB
/
main.yaml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: CI/CD Pipeline
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
verify:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'chore') && !startsWith(github.ref, 'refs/tags/v')"
strategy:
matrix:
python-version: [3.9, "3.10", 3.11]
steps:
- uses: actions/checkout@v1
- name: setting up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: install dependencies
run: make setup
- name: linting
run: make lint
test:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'chore') && !startsWith(github.ref, 'refs/tags/v')"
strategy:
max-parallel: 1
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: setup extensions
uses: actions/checkout@v1
- name: setting up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: install dependencies
run: make setup
- name: running unit tests
run: tox
- name: publishing code coverage report to codeclimate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
build/publishCodeCoverage.sh
- name: running integration tests
env:
SCC_ENV: ${{ secrets.SCC_ENV }}
SECURITY_AND_COMPLIANCE_CENTER_API_IAM_PROFILE_ID: ${{ secrets.SCC_IAM_PROFILE_ID }}
run: build/testScript.sh
release:
runs-on: ubuntu-latest
needs: [verify, test]
if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'chore')"
steps:
- name: setup extensions
uses: actions/checkout@v1
- name: setup nodejs
uses: actions/setup-node@v2
with:
node-version: '20'
- name: release using semantic-release
env:
PYPI_USER: ${{ secrets.PYPI_USER }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
GIT_AUTHOR_NAME: scccomm
GIT_AUTHOR_EMAIL: scccomm@in.ibm.com
GIT_COMMITTER_NAME: scccomm
GIT_COMMITTER_EMAIL: scccomm@in.ibm.com
run: |
pip install --user bumpversion
npm install @semantic-release/changelog
npm install @semantic-release/exec
npm install @semantic-release/git
npm install @semantic-release/github
rm -rf package.json
rm -rf package-lock.json
npx semantic-release
publish:
runs-on: ubuntu-latest
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')"
steps:
- name: setup extensions
uses: actions/checkout@v1
- name: install build module
run: |
python -m pip install --upgrade pip
pip install build
- name: build project
run: python -m build
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USER }}
password: ${{ secrets.PYPI_PASSWORD }}
repository_url: https://upload.pypi.org/legacy/
documentation:
runs-on: ubuntu-latest
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')"
steps:
- name: setup extensions
uses: actions/checkout@v1
- name: install pdoc
run: pip install pdoc
- name: generate pydoc
run: |
pip install -e .
pdoc ibm_scc -o html
- name: deploy python to gh-pages
run: |
git config --global user.email "scccomm@in.ibm.com"
git config --global user.name "sccdeveloper"
git config --global user.password "${{ secrets.ADMIN_TOKEN }}"
cd v4/dist
git init
git add .
git commit -m "Deploy to GitHub pages"
git branch -m gh-pages
git remote add origin https://github.com/IBM/scc-python-sdk
git push -f origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
GIT_AUTHOR_NAME: sccdeveloper
GIT_AUTHOR_EMAIL: scccomm@in.ibm.com
GIT_COMMITTER_NAME: sccdeveloper
GIT_COMMITTER_EMAIL: scccomm@in.ibm.com