Skip to content

Commit 5e5b011

Browse files
committed
Merge branch 'dev' into feat/ccb_refactor
2 parents 32f17e8 + 7d7a6ee commit 5e5b011

374 files changed

Lines changed: 15618 additions & 10240 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PUBLISHERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Niraj-Kamdar

.github/workflows/cd.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CD
2+
on:
3+
# When Pull Request is merged
4+
pull_request_target:
5+
types: [closed]
6+
7+
jobs:
8+
GetVersion:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 60
11+
outputs:
12+
version: ${{ env.RELEASE_VERSION }}
13+
if: |
14+
github.event.pull_request.user.login == 'polywrap-build-bot' &&
15+
github.event.pull_request.merged == true
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
- name: Halt release if CI failed
20+
run: exit 1
21+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
22+
- name: Read VERSION into env.RELEASE_VERSION
23+
run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV
24+
- name: Check if tag Exists
25+
id: tag_check
26+
shell: bash -ex {0}
27+
run: |
28+
GET_API_URL="https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}"
29+
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
30+
-H "Authorization: token ${GITHUB_TOKEN}")
31+
if [ "$http_status_code" -ne "404" ] ; then
32+
exit 1
33+
fi
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
Github-release:
38+
name: Create Release
39+
runs-on: ubuntu-latest
40+
needs:
41+
- GetVersion
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v2
45+
- name: print version with needs
46+
run: echo ${{ needs.GetVersion.outputs.version }}
47+
- id: changelog
48+
name: "Generate release changelog"
49+
uses: heinrichreimer/github-changelog-generator-action@v2.3
50+
with:
51+
unreleasedOnly: true
52+
unreleasedLabel: ${{ needs.GetVersion.outputs.version }}
53+
token: ${{ secrets.GITHUB_TOKEN }}
54+
continue-on-error: true
55+
- name: Create Release
56+
id: create_release
57+
uses: actions/create-release@v1
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
with:
61+
tag_name: ${{ needs.GetVersion.outputs.version }}
62+
release_name: Release ${{ needs.GetVersion.outputs.version }}
63+
body: ${{ steps.changelog.outputs.changelog }}
64+
draft: true
65+
prerelease: false

.github/workflows/ci.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: Python package
2-
1+
name: CI
32
on:
43
push:
54
branches:
65
- main
7-
- dev
86
pull_request:
97

108
jobs:
@@ -29,7 +27,7 @@ jobs:
2927
steps:
3028
- name: Checkout repository
3129
uses: actions/checkout@v3
32-
- name: Set up Python ${{ matrix.python-version }}
30+
- name: Set up Python 3.10
3331
uses: actions/setup-python@v4
3432
with:
3533
python-version: "3.10"
@@ -39,10 +37,9 @@ jobs:
3937
run: poetry install
4038
- name: Typecheck
4139
run: poetry run tox -e typecheck
42-
# FIXME: make this work
43-
# - name: Lint
44-
# run: poetry run tox -e lint
45-
# - name: Security
46-
# run: poetry run tox -e secure
40+
- name: Lint
41+
run: poetry run tox -e lint
42+
- name: Security
43+
run: poetry run tox -e secure
4744
- name: Test
4845
run: poetry run tox

.github/workflows/release-pr.yaml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Release-PR
2+
on:
3+
pull_request:
4+
types: [closed]
5+
6+
jobs:
7+
Pre-Check:
8+
if: |
9+
github.event.pull_request.merged &&
10+
endsWith(github.event.pull_request.title, '/workflows/release-pr') &&
11+
github.event.pull_request.user.login != 'polywrap-build-bot'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
ref: ${{github.event.pull_request.base.ref}}
18+
19+
- name: Pull-Request Creator Is Publisher?
20+
run: |
21+
exists=$(echo $(grep -Fxcs ${CREATOR} .github/PUBLISHERS))
22+
if [ "$exists" == "1" ] ; then
23+
echo IS_PUBLISHER=true >> $GITHUB_ENV
24+
else
25+
echo IS_PUBLISHER=false >> $GITHUB_ENV
26+
fi
27+
env:
28+
CREATOR: ${{github.event.pull_request.user.login}}
29+
30+
- name: Creator Is Not Publisher...
31+
if: env.IS_PUBLISHER == 'false'
32+
uses: actions/github-script@0.8.0
33+
with:
34+
github-token: ${{secrets.GITHUB_TOKEN}}
35+
script: |
36+
github.issues.createComment({
37+
issue_number: context.issue.number,
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
body: '${{github.event.pull_request.user.login}} is not a PUBLISHER. Please see the .github/PUBLISHERS file...'
41+
})
42+
43+
- name: Read VERSION into env.RELEASE_VERSION
44+
run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV
45+
46+
- name: Tag Exists?
47+
id: tag_check
48+
shell: bash -ex {0}
49+
run: |
50+
GET_API_URL="https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}"
51+
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
52+
-H "Authorization: token ${GITHUB_TOKEN}")
53+
if [ "$http_status_code" -ne "404" ] ; then
54+
echo TAG_EXISTS=true >> $GITHUB_ENV
55+
else
56+
echo TAG_EXISTS=false >> $GITHUB_ENV
57+
fi
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Release Already Exists...
62+
if: env.TAG_EXISTS == 'true'
63+
uses: actions/github-script@0.8.0
64+
with:
65+
github-token: ${{secrets.GITHUB_TOKEN}}
66+
script: |
67+
github.issues.createComment({
68+
issue_number: context.issue.number,
69+
owner: context.repo.owner,
70+
repo: context.repo.repo,
71+
body: '[Release Already Exists](https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}) (`${{env.RELEASE_VERSION}}`)'
72+
})
73+
74+
- name: Fail If Conditions Aren't Met...
75+
if: |
76+
env.IS_PUBLISHER != 'true' ||
77+
env.TAG_EXISTS != 'false'
78+
run: exit 1
79+
80+
Release-PR:
81+
needs: Pre-Check
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v3
86+
with:
87+
ref: ${{github.event.pull_request.base.ref}}
88+
89+
- name: set env.RELEASE_FORKS to Release Forks' Organization
90+
run: echo RELEASE_FORKS=polywrap-release-forks >> $GITHUB_ENV
91+
92+
- name: Set env.BUILD_BOT to Build Bot's Username
93+
run: echo BUILD_BOT=polywrap-build-bot >> $GITHUB_ENV
94+
95+
- name: Read VERSION into env.RELEASE_VERSION
96+
run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV
97+
98+
- name: Building Release PR...
99+
uses: actions/github-script@0.8.0
100+
with:
101+
github-token: ${{secrets.GITHUB_TOKEN}}
102+
script: |
103+
github.issues.createComment({
104+
issue_number: context.issue.number,
105+
owner: context.repo.owner,
106+
repo: context.repo.repo,
107+
body: '[Building Release PR](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) (`${{env.RELEASE_VERSION}}`)'
108+
})
109+
110+
- name: Set up Python 3.10
111+
uses: actions/setup-python@v4
112+
with:
113+
python-version: "3.10"
114+
115+
- name: Install poetry
116+
run: curl -sSL https://install.python-poetry.org | python3 -
117+
118+
- name: Set Git Identity
119+
run: |
120+
git config --global user.name '${{env.BUILD_BOT}}'
121+
git config --global user.email '${{env.BUILD_BOT}}@users.noreply.github.com'
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.POLYWRAP_BUILD_BOT_PAT }}
124+
125+
- name: Apply Python Version & Commit
126+
run: bash ./scripts/publishPackages.sh ${{env.RELEASE_VERSION}} __token__ ${{secrets.POLYWRAP_BUILD_BOT_PYPI_PAT}}
127+
128+
- name: Create Pull Request
129+
id: cpr
130+
uses: peter-evans/create-pull-request@v3
131+
with:
132+
token: ${{ secrets.POLYWRAP_BUILD_BOT_PAT }}
133+
push-to-fork: ${{env.RELEASE_FORKS}}/${{github.event.pull_request.base.repo.name}}
134+
branch: release/origin-${{env.RELEASE_VERSION}}
135+
base: ${{github.event.pull_request.base.ref}}
136+
committer: GitHub <noreply@github.com>
137+
author: ${{env.BUILD_BOT}} <${{env.BUILD_BOT}}@users.noreply.github.com>
138+
commit-message: "${{env.RELEASE_VERSION}}"
139+
title: 'Python client (${{env.RELEASE_VERSION}})'
140+
body: |
141+
## Python client (${{env.RELEASE_VERSION}})
142+
143+
### Breaking Changes
144+
145+
- [ ] TODO
146+
147+
### Features
148+
149+
- [ ] TODO
150+
151+
### Bug Fixes
152+
153+
- [ ] TODO
154+
155+
- name: Release PR Created...
156+
uses: actions/github-script@0.8.0
157+
with:
158+
github-token: ${{secrets.GITHUB_TOKEN}}
159+
script: |
160+
github.issues.createComment({
161+
issue_number: context.issue.number,
162+
owner: context.repo.owner,
163+
repo: context.repo.repo,
164+
body: '**[Release PR Created](https://github.com/${{github.repository}}/pull/${{ steps.cpr.outputs.pull-request-number }}) (`${{env.RELEASE_VERSION}}`)**'
165+
})

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0a14

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

0 commit comments

Comments
 (0)