Skip to content

Commit

Permalink
build: improve CI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Agrendalath committed Jan 17, 2024
1 parent 5523d87 commit a86bcd8
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 34 deletions.
53 changes: 19 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,41 @@ name: Python CI

on:
push:
branches:
- master
branches: [ master ]
pull_request:
branches:
- '**'
workflow_dispatch:

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
run_tests:
name: Tests
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: [3.8]
toxenv: [ quality, unit, integration ]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
toxenv: [django32, django42, quality, package]

- name: Install Required System Packages
if: matrix.toxenv == 'integration'
run: sudo apt-get update && sudo apt-get install libxmlsec1-dev ubuntu-restricted-extras xvfb

- name: Use Gecko Driver
if: matrix.toxenv == 'integration'
uses: browser-actions/setup-geckodriver@latest
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
submodules: recursive

- name: setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install -U pip wheel
pip install tox pylint
- name: Install Dependencies
run: make requirements

- name: Run Quality
env:
TOXENV: ${{ matrix.toxenv }}
if: matrix.toxenv == 'quality'
run: |
tox -e quality
- name: Run Unit Tests
env:
TOXENV: ${{ matrix.toxenv }}
if: matrix.toxenv == 'unit'
run: tox -e unit
- name: Run Integration Tests
- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
if: matrix.toxenv == 'integration'
run: xvfb-run --auto-servernum tox -e integration
run: tox
30 changes: 30 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish package to PyPI

on:
release:
types: [published]

jobs:
push:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: setup python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install Dependencies
run: pip install -r requirements/pip.txt

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/upgrade-python-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Upgrade Python Requirements

on:
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:
inputs:
branch:
description: Target branch against which to create requirements PR
required: true
default: master

jobs:
call-upgrade-python-requirements-workflow:
uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master
# Do not run on forks
if: github.repository_owner == 'openedx'
with:
branch: ${{ github.event.inputs.branch || 'master' }}
# optional parameters below; fill in if you'd like github or email notifications
# user_reviewers: ""
# team_reviewers: ""
# email_address: ""
# send_success_notification: false
secrets:
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}

0 comments on commit a86bcd8

Please sign in to comment.