-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from mmacata/wheel-build-adjustments
Prepare for wheel building
- Loading branch information
Showing
5 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM alpine:edge as build | ||
|
||
RUN apk add git python3 | ||
RUN pip3 install --upgrade pip pep517 wheel | ||
|
||
# Build | ||
COPY . /src/actinia_statistic_plugin | ||
WORKDIR /src/actinia_statistic_plugin | ||
# TODO: include tests. Currently only running whith actinia_core installed | ||
# RUN pip3 install -r requirements.txt && python3 setup.py test | ||
RUN python3 -m pep517.build --out-dir /build . && \ | ||
pip3 wheel -r requirements.txt -w /build | ||
|
||
|
||
FROM alpine:edge | ||
|
||
COPY --from=build /build/actinia*.whl /build/ | ||
COPY docker/create_release_with_asset.sh . | ||
|
||
ARG release_url=https://api.github.com/repos/mundialis/actinia_statistic_plugin/releases | ||
ARG tag=0.0 | ||
ARG credentials=dummy:dummy | ||
ARG file=/build/actinia*.whl | ||
|
||
ENV env_release_url=$release_url | ||
ENV env_tag=$tag | ||
ENV env_credentials=$credentials | ||
ENV env_file=$file | ||
|
||
RUN apk add curl jq | ||
|
||
ENTRYPOINT ["/bin/sh"] | ||
CMD ["./create_release_with_asset.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
To create a new release, you can use this docker to build the wheel and add | ||
to the release. | ||
|
||
The `docker build` command builds the wheel and integrated the build-args for | ||
the github release. | ||
|
||
The `docker run` command creates the build and uploads the | ||
before created wheel as asset. | ||
|
||
|
||
``` | ||
git clone [email protected]:mundialis/actinia_statistic_plugin.git | ||
cd actinia_statistic_plugin | ||
tag=0.0 | ||
credentials=mygithubuser:mygithubpw | ||
docker build --file docker/Dockerfile --build-arg tag=$tag --build-arg credentials=$credentials --tag actinia_statistic_plugin:build . | ||
docker run --rm actinia_statistic_plugin:build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
|
||
# needed to be set as ENVs before: | ||
#env_release_url | ||
#env_tag | ||
#env_credentials | ||
#env_file | ||
|
||
filefull=`ls $env_file` | ||
filename=$(basename $filefull) | ||
|
||
|
||
echo "{\"tag_name\": \"$env_tag\",\"target_commitish\": \"master\",\"name\":\"$env_tag\",\"body\": \"Automatically created by CI\",\"draft\": false,\"prerelease\": false}" > /tmp/release_payload.json | ||
|
||
# Create release | ||
curl -u $env_credentials -X POST -H 'Content-Type: application/json' -d @/tmp/release_payload.json $env_release_url > resp.json && cat resp.json | ||
|
||
# parse response to create upload_url | ||
upload_url=`cat resp.json | jq '.upload_url' | tr -d '"' | cut -d '{' -f1` | ||
url=$upload_url?name=$filename | ||
|
||
if [ "$upload_url" == "null" ] | ||
then | ||
echo "Failed to create release, aborting." | ||
exit 1 | ||
fi | ||
|
||
curl -u $env_credentials -H "Accept: application/vnd.github.manifold-preview" -H "Content-Type: application/zip" --data-binary @$filefull "$url" > resp.json && cat resp.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["setuptools>=40.6.0", "wheel"] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters