Skip to content

Commit

Permalink
ci: Optimize actions (grapheneX#187)
Browse files Browse the repository at this point in the history
* update linter ci

* optimize build ci

* cosmetics
  • Loading branch information
jxdv authored Jan 31, 2024
1 parent 04adeba commit 3068b26
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 37 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,75 @@ name: Continuous Integration
on:
workflow_dispatch:
pull_request:
branches:
- master
branches: [ master ]
paths:
- "docker/**"
- "graphenex/**"
push:
branches:
- master
branches: [ master ]
paths:
- "docker/**"
- "graphenex/**"

jobs:
setup_linux:
name: "Linux setup"
name: Linux setup
runs-on: ubuntu-latest

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

- name: "Install dependencies"
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
--allow-unauthenticated python3-pip
- name: Python setup
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install poetry
uses: snok/install-poetry@v1

- name: "Install grapheneX"
- name: Install grapheneX
run: |
python3 -m pip install poetry
poetry install
- name: "Python import issue workaround"
- name: Python import issue workaround
run: |
sed -i '/Mapping/s/collections/collections.abc/' \
/home/runner/.cache/pypoetry/virtualenvs/graphenex--sEiZHBC-py3.10/lib/python3.10/site-packages/prompt_toolkit/styles/from_dict.py
- name: "Run grapheneX"
- name: Run grapheneX
run: poetry run grapheneX

setup_windows:
name: "Windows setup"
name: Windows setup
runs-on: windows-latest

defaults:
run:
shell: bash

steps:
- name: checkout
uses: actions/checkout@v4

- name: "Install python"
- name: Python setup
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"

- name: "Update pip"
run: python -m pip install --upgrade pip
- name: Install poetry
uses: snok/install-poetry@v1

- name: "Install grapheneX"
- name: Install grapheneX
run: |
python3 -m pip install poetry
poetry install
- name: "Python import issue workaround"
- name: Python import issue workaround
shell: pwsh
run: (Get-Content C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\graphenex-6fD1lE0z-py3.10\lib\site-packages\prompt_toolkit\styles\from_dict.py) -Replace 'from collections import Mapping', 'from collections.abc import Mapping' | Set-Content C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\graphenex-6fD1lE0z-py3.10\lib\site-packages\prompt_toolkit\styles\from_dict.py

- name: "Update Flask-SocketIO"
run: python3 -m pip install --upgrade flask_socketio
- name: Update Flask-SocketIO
run: python -m pip install --upgrade flask_socketio

- name: "run grapheneX"
- name: Run grapheneX
run: poetry run grapheneX
8 changes: 3 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ name: Docker Automated Build

on:
push:
branches:
- master
branches: [ master ]
tags:
- ".*"
pull_request:
branches:
- master
branches: [ master ]

jobs:
docker:
name: Docker Build and Push
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: Checkout
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
name: Ruff

on: [ push, pull_request ]
on:
push:
branches: [ master ]
paths:
- 'grapheneX/**/*.py'
pull_request:
branches: [ master ]
paths:
- 'grapheneX/**/.py'

jobs:
ruff:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ name: PyPI Automated publish

on:
pull_request:
branches:
- master
branches: [ master ]
push:
tags:
- "*"
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: Checkout
Expand Down

0 comments on commit 3068b26

Please sign in to comment.