Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MAfarrag committed Nov 24, 2023
1 parent 8eac5d4 commit 3c6ff37
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 43 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/conda-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Conda
on: [push]
jobs:
Main-package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
env:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
#use-mamba: true
auto-update-conda: false
environment-file: environment.yml
auto-activate-base: false
activate-environment: test
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: true
show-channel-urls: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dev-dependencies
run: |
python -m pip install -r requirements-dev.txt
- name: Run tests
shell: bash -el {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
pytest -sv
36 changes: 36 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Create GitHub Release

on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup GitHub CLI
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- name: Extract tag name
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV


- name: Create GitHub Release
id: create_release
run: |
gh release create $TAG_NAME --title "$TAG_NAME" --notes-from-tag
env:
GH_TOKEN: ${{ secrets.CREATE_RELEASE }}
34 changes: 34 additions & 0 deletions .github/workflows/publish-pypi-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: pypi-publish

on:
workflow_dispatch:
release:
types: [released, published, created]

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERS }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux
name: Pypi deployment
on:
push:
branches:
Expand All @@ -11,33 +11,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
env:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt
python setup.py install
- name: Install & Lint with flake8
run: |
pip install flake8
flake8 --max-line-length=120 statista/*.py tests/*.py
- name: Generate coverage report
run: |
pip install pytest
pip install pytest-cov
python -m pytest -vvv --cov=statista --cov-report=xml
python -m pytest -vvv --cov=statista --cov-report=xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
30 changes: 0 additions & 30 deletions .github/workflows/pypi.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI
on: [push, pull_request]
jobs:
Run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest] #, macos-latest, windows-latest
python-version: ["3.9" ] # "3.7", "3.8",
env:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge
allow-softlinks: true
channel-priority: flexible
show-channel-urls: true

- name: Install dependencies
run: |
$CONDA/bin/conda install --yes --file requirements.txt
python setup.py install
# - name: Lint with flake8
# run: |
# # add CONDA/bin/ in front of everything
# $CONDA/bin/conda install flake8
# # stop the build if there are Python syntax errors or undefined names
# $CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# $CONDA/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Generate coverage report
# working-directory: ../
run: |
pwd
$CONDA/bin/pytest --cov=statista --cov-report=xml
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage1.xml,./coverage2.xml
# directory: ./coverage/reports/
# flags: unittests
# env_vars: OS,PYTHON
# name: codecov-umbrella
# fail_ci_if_error: true
# path_to_write_report: ./coverage/codecov_report.txt
# verbose: true

- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
github-token: ${{ secrets.github_token }}
files: ./coverage1.xml,./coverage2.xml
directory: ./coverage/reports/

0 comments on commit 3c6ff37

Please sign in to comment.