-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (101 loc) · 4.3 KB
/
test_and_deploy.yml
File metadata and controls
117 lines (101 loc) · 4.3 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
################################################################################
# Test and Deployment for the Ibis API.
#
#
# Author: W.R. Jackson, DAMP/CIDAR Research Engineer, 2021
################################################################################
on:
push:
branches:
- main
- feat/better-ci-and-cd
name: Perform Tests on Available Platforms.
jobs:
continuous-integration:
name: Perform Tests on Available Platforms
strategy:
fail-fast: false
matrix:
python-version: [3.8]
os: [ubuntu-18.04]
runs-on: ${{ matrix.os }}
steps:
# -----------------------------------------------------------------------
# Check out the repository and setup our baseline Python environment
# -----------------------------------------------------------------------
- name: Checkout Ibis Repository
uses: actions/checkout@v2
- name: Set up our requested Python Version
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# -----------------------------------------------------------------------
# Install external tool dependencies like iverilog
# -----------------------------------------------------------------------
- name: Install Ubuntu Dependencies
run: |
sudo apt-get install iverilog
# -----------------------------------------------------------------------
# Install baseline Poetry, check for caching, and then install our env.
# -----------------------------------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.2
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load Cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install library
run: poetry install --no-interaction
# -----------------------------------------------------------------------
# Run our Tests. Implicit Failure will stop us from deploying to PyPi
# -----------------------------------------------------------------------
- name: Run tests
run: |
source .venv/bin/activate
pytest tests/
continuous-deployment:
name: Deploys validated libray to PyPi and triggers light messaging.
needs: continuous-integration
runs-on: ubuntu-latest
steps:
# -----------------------------------------------------------------------
# Check out the repository and setup our baseline Python environment
# -----------------------------------------------------------------------
- name: Checkout CelloAPI2 Repository
uses: actions/checkout@v2
# -----------------------------------------------------------------------
# Bump the Version of the Repository via Poetry, and then publish.
# -----------------------------------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.2
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Bump library and Publish.
run: |
poetry build
poetry version patch
git add pyproject.toml
git config --global user.name 'W.R. Jackson'
git config --global user.email 'wrjackso@bu.edu'
git commit -am 'Automated Bump {CI/CD}'
git push
poetry publish --build -u ${{ secrets.pypi_username }} -p ${{ secrets.pypi_password }}
# -----------------------------------------------------------------------
# Let Jackson know everything is cool.
# -----------------------------------------------------------------------
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: general
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: 'New Version of Ibis Deployed to Pypi :rocket:'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}