-
Notifications
You must be signed in to change notification settings - Fork 9
93 lines (90 loc) · 2.89 KB
/
ci.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: CI
on:
push:
branches:
- '*'
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Prepare Environment
run: |
chmod +x ./ci/prepare_env.sh && ./ci/prepare_env.sh
- name: Install Dependencies
run: |
poetry install
- name: Lint
run: |
poetry run flake8 ./tests ./sklearn_nature_inspired_algorithms
- name: Tests
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
poetry run coverage run --source=./sklearn_nature_inspired_algorithms -m unittest tests
poetry run coverage report
- name: Build
run: |
poetry build
- uses: actions/upload-artifact@v1
if: ${{ matrix['python-version'] == 3.8 }}
with:
name: dist
path: dist
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/download-artifact@v1
with:
name: dist
- name: Prepare Release
run: |
echo "LIB_WHL_PATH=$(find dist -type f -name '*.whl')" >> $GITHUB_ENV
echo "LIB_WHL_NAME=$(find dist -type f -name '*.whl' -exec basename {} \;)" >> $GITHUB_ENV
echo "LIB_TAR_GZ_PATH=$(find dist -type f -name '*.tar.gz')" >> $GITHUB_ENV
echo "LIB_TAR_GZ_NAME=$(find dist -type f -name '*.tar.gz' -exec basename {} \;)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Release Asset (.tar.gz)
id: upload-release-asset-tar-gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.LIB_TAR_GZ_PATH }}
asset_name: ${{ env.LIB_TAR_GZ_NAME }}
asset_content_type: application/gzip
- name: Upload Release Asset (.whl)
id: upload-release-asset-whl
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.LIB_WHL_PATH }}
asset_name: ${{ env.LIB_WHL_NAME }}
asset_content_type: application/gzip