From 44680121aae93e86ded94146bb74f30d553adf53 Mon Sep 17 00:00:00 2001 From: Jawayria Date: Mon, 16 Aug 2021 18:11:24 +0500 Subject: [PATCH 1/3] feat: Shifted CI from Travis to Github Actions --- .github/workflows/ci.yml | 43 +++++++++++++++++++++++++++++ .github/workflows/pypi-publish.yml | 33 ++++++++++++++++++++++ Makefile | 4 ++- requirements/{travis.in => ci.in} | 0 requirements/{travis.txt => ci.txt} | 18 ++++++------ requirements/pip.in | 5 ++++ requirements/pip.txt | 14 ++++++++++ 7 files changed, 107 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pypi-publish.yml rename requirements/{travis.in => ci.in} (100%) rename requirements/{travis.txt => ci.txt} (73%) create mode 100644 requirements/pip.in create mode 100644 requirements/pip.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c37d343 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: Python CI + +on: + push: + branches: [master] + pull_request: + branches: + - '**' + +jobs: + run_tests: + name: Tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + python-version: ['3.8'] + toxenv: [django22, django30, django31, django32, quality, docs, pii_check] + + steps: + - uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install pip + run: pip install -r requirements/pip.txt + + - name: Install Dependencies + run: pip install -r requirements/ci.txt + + - name: Run Tests + env: + TOXENV: ${{ matrix.toxenv }} + run: tox + + - name: Run Coverage + if: matrix.python-version == '3.8' && matrix.toxenv=='django22' + uses: codecov/codecov-action@v1 + with: + flags: unittests + fail_ci_if_error: true \ No newline at end of file diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..8ac5119 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,33 @@ +name: Publish package to PyPi + +on: + release: + types: [published] + +jobs: + + push: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install pip + run: pip install -r requirements/pip.txt + + - name: Install Dependencies + run: pip install setuptools wheel + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Publish to PyPi + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_UPLOAD_TOKEN }} \ No newline at end of file diff --git a/Makefile b/Makefile index 6e10cc3..43fbdd1 100644 --- a/Makefile +++ b/Makefile @@ -42,12 +42,13 @@ upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in pip install -qr requirements/pip-tools.txt # Make sure to compile files after any other files they include! + pip-compile --rebuild --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in pip-compile --rebuild --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in pip-compile --rebuild --upgrade -o requirements/base.txt requirements/base.in pip-compile --rebuild --upgrade -o requirements/test.txt requirements/test.in pip-compile --rebuild --upgrade -o requirements/doc.txt requirements/doc.in pip-compile --rebuild --upgrade -o requirements/quality.txt requirements/quality.in - pip-compile --rebuild --upgrade -o requirements/travis.txt requirements/travis.in + pip-compile --rebuild --upgrade -o requirements/ci.txt requirements/ci.in pip-compile --rebuild --upgrade -o requirements/dev.txt requirements/dev.in # Let tox control the Django version for tests sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp @@ -60,6 +61,7 @@ pii_check: ## check for PII annotations on all Django models tox -e pii_check requirements: ## install development environment requirements + pip install -qr requirements/pip.txt pip install -qr requirements/pip-tools.txt pip-sync requirements/dev.txt requirements/private.* diff --git a/requirements/travis.in b/requirements/ci.in similarity index 100% rename from requirements/travis.in rename to requirements/ci.in diff --git a/requirements/travis.txt b/requirements/ci.txt similarity index 73% rename from requirements/travis.txt rename to requirements/ci.txt index 74ad5ee..336c1d7 100644 --- a/requirements/travis.txt +++ b/requirements/ci.txt @@ -2,16 +2,16 @@ # This file is autogenerated by pip-compile with python 3.8 # To update, run: # -# make upgrade +# pip-compile --output-file=requirements/ci.txt requirements/ci.in # backports.entry-points-selectable==1.1.0 # via virtualenv certifi==2021.5.30 # via requests -charset-normalizer==2.0.3 +charset-normalizer==2.0.4 # via requests -codecov==2.1.11 - # via -r requirements/travis.in +codecov==2.1.12 + # via -r requirements/ci.in coverage==5.5 # via codecov distlib==0.3.2 @@ -24,7 +24,7 @@ idna==3.2 # via requests packaging==21.0 # via tox -platformdirs==2.1.0 +platformdirs==2.2.0 # via virtualenv pluggy==0.13.1 # via tox @@ -40,13 +40,13 @@ six==1.16.0 # virtualenv toml==0.10.2 # via tox -tox==3.24.0 +tox==3.24.1 # via - # -r requirements/travis.in + # -r requirements/ci.in # tox-battery tox-battery==0.6.1 - # via -r requirements/travis.in + # via -r requirements/ci.in urllib3==1.26.6 # via requests -virtualenv==20.6.0 +virtualenv==20.7.2 # via tox diff --git a/requirements/pip.in b/requirements/pip.in new file mode 100644 index 0000000..7b68e86 --- /dev/null +++ b/requirements/pip.in @@ -0,0 +1,5 @@ +# Core dependencies for installing other packages + +pip +setuptools +wheel \ No newline at end of file diff --git a/requirements/pip.txt b/requirements/pip.txt new file mode 100644 index 0000000..5827e49 --- /dev/null +++ b/requirements/pip.txt @@ -0,0 +1,14 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile --allow-unsafe --output-file=requirements/pip.txt requirements/pip.in +# +wheel==0.37.0 + # via -r requirements/pip.in + +# The following packages are considered to be unsafe in a requirements file: +pip==21.2.4 + # via -r requirements/pip.in +setuptools==57.4.0 + # via -r requirements/pip.in From 8cd75c5748b14b5ef14ba2e9d884f4c2d6fba725 Mon Sep 17 00:00:00 2001 From: Jawayria Date: Mon, 16 Aug 2021 18:17:20 +0500 Subject: [PATCH 2/3] Remove travis --- .travis.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 65ea655..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: python -python: - - '3.8' -env: - - TOXENV=quality - - TOXENV=docs - - TOXENV=pii_check - - TOXENV=django22 - - TOXENV=django30 - - TOXENV=django31 - - TOXENV=django32 -cache: - - pip -install: - - pip install -r requirements/travis.txt -script: - - tox -after_success: - - codecov -deploy: - provider: pypi - user: edx - distributions: sdist bdist_wheel - on: - tags: true - python: 3.8 - condition: $TOXENV = quality - password: - secure: rh1C0D29KRN7O7CFFNajMnlSeIhbuArdF4VKLsPjR+GlfoSjKur0j2CdJGd0znr5vlNAQFgSHMLwGWhCrIFSTu6HUFT8PJhfVZ2M7IFDMwleq2k1aLYyk54ZVtZfVuy50c1uaS1CjTGJ55kccNYPrMf+CQCi/DZRe1MeogX3D1C7OtksyneRjPtIdz+l2jiqcwrrwDAJgOqSwONmgc1gI7HWHd4xLZinu/JeTLkYh3gTUBVBqv52reNbO3J4PUu+tFX37FTZnEebC5dLJyHFPJ89Fqz3gJDXwcUDcvtWhnWKjt9Hi+Xa8UvycdUygPuFMPfq8U2sLHX1L61WIODimpj66qGVgSK2B1vltqfvAFq5FS9g7ivzG3K6ANq4c/csouJv8ib6/J7J/G4ubsqgcFtBM3ag+T+dTTx8cNBskK2JhX6UMARh+zPkTTWpepqla30axMT9jTZ0O8PqgzbrtvWMxBssfbUpmu2WjpdL8KA8YFsEksY42gN+sFxNp45m31ABsIiaWc38GrHYibWt2BT/PThXroysQygwq38jQX6jIGnq6BPFY22XdTtll9xPTyKAcBQPOMNdhaBQME9h1QbNuyCFLgmsBfzrSIMA6pZGdthiwB/L3Jj11NNatf/bL0LnjpzIRywecLOeIvUo3agnIoTVymyLu/2zUZqWd7E= From 66c6e430f79d3bc63a553f34ab8fd7f7ee6163a8 Mon Sep 17 00:00:00 2001 From: Jawayria Date: Mon, 16 Aug 2021 20:28:17 +0500 Subject: [PATCH 3/3] Add travis again --- .travis.yml | 29 +++++++++++++++++++++++ requirements/ci.in | 2 +- requirements/travis.in | 7 ++++++ requirements/travis.txt | 52 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100644 requirements/travis.in create mode 100644 requirements/travis.txt diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..65ea655 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +language: python +python: + - '3.8' +env: + - TOXENV=quality + - TOXENV=docs + - TOXENV=pii_check + - TOXENV=django22 + - TOXENV=django30 + - TOXENV=django31 + - TOXENV=django32 +cache: + - pip +install: + - pip install -r requirements/travis.txt +script: + - tox +after_success: + - codecov +deploy: + provider: pypi + user: edx + distributions: sdist bdist_wheel + on: + tags: true + python: 3.8 + condition: $TOXENV = quality + password: + secure: rh1C0D29KRN7O7CFFNajMnlSeIhbuArdF4VKLsPjR+GlfoSjKur0j2CdJGd0znr5vlNAQFgSHMLwGWhCrIFSTu6HUFT8PJhfVZ2M7IFDMwleq2k1aLYyk54ZVtZfVuy50c1uaS1CjTGJ55kccNYPrMf+CQCi/DZRe1MeogX3D1C7OtksyneRjPtIdz+l2jiqcwrrwDAJgOqSwONmgc1gI7HWHd4xLZinu/JeTLkYh3gTUBVBqv52reNbO3J4PUu+tFX37FTZnEebC5dLJyHFPJ89Fqz3gJDXwcUDcvtWhnWKjt9Hi+Xa8UvycdUygPuFMPfq8U2sLHX1L61WIODimpj66qGVgSK2B1vltqfvAFq5FS9g7ivzG3K6ANq4c/csouJv8ib6/J7J/G4ubsqgcFtBM3ag+T+dTTx8cNBskK2JhX6UMARh+zPkTTWpepqla30axMT9jTZ0O8PqgzbrtvWMxBssfbUpmu2WjpdL8KA8YFsEksY42gN+sFxNp45m31ABsIiaWc38GrHYibWt2BT/PThXroysQygwq38jQX6jIGnq6BPFY22XdTtll9xPTyKAcBQPOMNdhaBQME9h1QbNuyCFLgmsBfzrSIMA6pZGdthiwB/L3Jj11NNatf/bL0LnjpzIRywecLOeIvUo3agnIoTVymyLu/2zUZqWd7E= diff --git a/requirements/ci.in b/requirements/ci.in index ee2c001..06a74e8 100644 --- a/requirements/ci.in +++ b/requirements/ci.in @@ -1,4 +1,4 @@ -# Requirements for running tests in Travis +# Requirements for running tests in Github Actions -c constraints.txt diff --git a/requirements/travis.in b/requirements/travis.in new file mode 100644 index 0000000..ee2c001 --- /dev/null +++ b/requirements/travis.in @@ -0,0 +1,7 @@ +# Requirements for running tests in Travis + +-c constraints.txt + +codecov # Code coverage reporting +tox # Virtualenv management for tests +tox-battery # Makes tox aware of requirements file changes diff --git a/requirements/travis.txt b/requirements/travis.txt new file mode 100644 index 0000000..74ad5ee --- /dev/null +++ b/requirements/travis.txt @@ -0,0 +1,52 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# make upgrade +# +backports.entry-points-selectable==1.1.0 + # via virtualenv +certifi==2021.5.30 + # via requests +charset-normalizer==2.0.3 + # via requests +codecov==2.1.11 + # via -r requirements/travis.in +coverage==5.5 + # via codecov +distlib==0.3.2 + # via virtualenv +filelock==3.0.12 + # via + # tox + # virtualenv +idna==3.2 + # via requests +packaging==21.0 + # via tox +platformdirs==2.1.0 + # via virtualenv +pluggy==0.13.1 + # via tox +py==1.10.0 + # via tox +pyparsing==2.4.7 + # via packaging +requests==2.26.0 + # via codecov +six==1.16.0 + # via + # tox + # virtualenv +toml==0.10.2 + # via tox +tox==3.24.0 + # via + # -r requirements/travis.in + # tox-battery +tox-battery==0.6.1 + # via -r requirements/travis.in +urllib3==1.26.6 + # via requests +virtualenv==20.6.0 + # via tox