-
Notifications
You must be signed in to change notification settings - Fork 0
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 #8 from soda480/0.3.1
build: add ability to build against all targeted Python versions
- Loading branch information
Showing
6 changed files
with
71 additions
and
33 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 |
---|---|---|
@@ -1,33 +1,56 @@ | ||
name: build | ||
on: | ||
schedule: | ||
- cron: "0 8 * * *" | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
build-images: | ||
strategy: | ||
matrix: | ||
version: ['3.7', '3.8', '3.9', '3.10'] | ||
name: Build Python Docker images | ||
runs-on: ubuntu-20.04 | ||
container: python:3.9-slim | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install pybuilder | ||
run: pip install pybuilder | ||
|
||
- name: Execute build | ||
run: pyb | ||
|
||
- name: Install Codecov requirements | ||
run: | | ||
apt-get update | ||
apt-get install -y bash curl | ||
sed -e 's,filename="pybuilder-bandit/,filename="src/main/python/pybuilder_bandit/,g' target/reports/pybuilder-bandit_coverage.xml > coverage.xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: coverage.xml | ||
- uses: actions/checkout@v3 | ||
- name: build pybbandit ${{ matrix.version }} image | ||
run: | ||
docker image build --build-arg PYTHON_VERSION=${{ matrix.version }} -t pybbandit:${{ matrix.version }} . | ||
- name: save pybbandit ${{ matrix.version }} image | ||
if: ${{ matrix.version == '3.9' }} | ||
run: | | ||
mkdir -p images | ||
docker save --output images/pybbandit-${{ matrix.version }}.tar pybbandit:${{ matrix.version }} | ||
- name: upload pybbandit ${{ matrix.version }} image artifact | ||
if: ${{ matrix.version == '3.9' }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: image | ||
path: images/pybbandit-${{ matrix.version }}.tar | ||
coverage: | ||
name: Publish Code Coverage Report | ||
needs: build-images | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: download image artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: image | ||
path: images/ | ||
- name: load image | ||
run: | ||
docker load --input images/pybbandit-3.9.tar | ||
- name: prepare report | ||
run: | | ||
ID=$(docker create pybbandit:3.9) | ||
docker cp $ID:/code/target/reports/pybuilder-bandit_coverage.xml pybbandit_coverage.xml | ||
sed -i -e 's,filename="pybbandit/,filename="src/main/python/pybbandit/,g' pybbandit_coverage.xml | ||
- name: upload report | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: pybbandit_coverage.xml |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
FROM python:3.9-slim | ||
ARG PYTHON_VERSION=3.9 | ||
FROM python:${PYTHON_VERSION}-slim | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
WORKDIR /code | ||
COPY . /code/ | ||
RUN pip install pybuilder | ||
RUN pyb | ||
RUN pip install --upgrade pip && pip install pybuilder | ||
RUN pyb -X |
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
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
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,5 @@ | ||
versions=( '3.7' '3.8' '3.9' '3.10' ) | ||
for version in "${versions[@]}"; | ||
do | ||
docker image build --build-arg PYTHON_VERSION=$version -t pybbandit:$version . | ||
done |
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 = ["pybuilder>=0.12.0"] | ||
build-backend = "pybuilder.pep517" |