generated from funnyzak/pyproject-starter
-
Notifications
You must be signed in to change notification settings - Fork 16
57 lines (54 loc) · 1.62 KB
/
run.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Run Project
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
inputs:
script_name:
description: 'poetry script name'
required: true
default: ''
env:
POETRY_SCRIPT_NAME_LIST: 'example'
jobs:
run-project:
name: Run project on ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' || github.event.inputs.script_name != ''
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
poetry-version: ['1.3.1']
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry install --sync --all-extras
- name: Run poetry script
run: |
if [ -z "${{ github.event.inputs.script_name }}" ]; then
echo "No script name provided, running all scripts"
for script_name in $(echo "${{ env.POETRY_SCRIPT_NAME_LIST }}" | tr "," " ")
do
echo "Running poetry script $script_name"
poetry run $script_name
done
else
echo "Running poetry script ${{ github.event.inputs.script_name }}"
poetry run ${{ github.event.inputs.script_name }}
fi