-
Notifications
You must be signed in to change notification settings - Fork 9
109 lines (98 loc) · 3.92 KB
/
ci-cd.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# This is a basic workflow to help you get started with Actions
name: CI-CD
on: push
env:
PROJECT_ROOT: ${{ github.workspace }}
jobs:
tests:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest", "windows-2019"]
python-version: ["3.9", "3.10", "3.11"]
exclude:
# Due to nbconvert TypeError
- os: windows-latest
python-version: "3.7"
# Due to nbconvert TypeError
- os: windows-2019
python-version: "3.7"
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install package dependencies"
run: |
python -VV
python -m site
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions
python -m pip install -r requirements.txt
python -m pip install .
- name: "Run package tests for ${{ matrix.python-version }}, ${{ matrix.os }}"
run: "python -m pytest -vv -m 'not latex and not notebook'"
- name: "Run notebook tests for ${{ matrix.python-version }} if ubuntu os"
run: |
echo "${{ matrix.os }}"
sudo apt-get install graphviz
python -m pytest -vv -m notebook
if: matrix.os == 'ubuntu-latest'
- name: "Run notebook tests for ${{ matrix.python-version }} if mac os"
run: |
echo "${{ matrix.os }}"
brew install graphviz
python -m pytest -vv -m notebook
if: matrix.os == 'macos-latest'
- name: "Run notebook tests for ${{ matrix.python-version }} if windows os"
run: |
echo "${{ matrix.os }}"
choco install graphviz
python -m pytest -vv -m notebook
if: matrix.os == 'windows-latest'
- name: "Run latex tests for ${{ matrix.python-version }} if ubuntu os"
run: |
echo "${{ matrix.os }}"
sudo apt-get install texlive-latex-extra
python -m pytest -vv -m latex
if: matrix.os == 'ubuntu-latest'
deliver:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies for latex slide delivery"
run: |
sudo apt-get install texlive-latex-extra
python -VV
python -m site
python -m pip install .
- name: "Create slides"
run: |
mkdir -p tex_out
python risk_learning/tex.py --filepath ${{ github.workspace }}/slides/intro/ai-risk-and-discrete-geometry.tex --outdir ${{ github.workspace }}/tex_out
python risk_learning/tex.py --filepath ${{ github.workspace }}/slides/discrete-geometry/discrete-geometry.tex --outdir ${{ github.workspace }}/tex_out
python risk_learning/tex.py --filepath ${{ github.workspace }}/slides/correlation-causality/correlation-causality.tex --outdir ${{ github.workspace }}/tex_out
python risk_learning/tex.py --filepath ${{ github.workspace }}/slides/adversarial-regularization-regimes/adversarial.tex --outdir ${{ github.workspace }}/tex_out
cd tex_out
ls -al
- name: "Archive slide artifacts"
uses: actions/upload-artifact@v3
with:
name: risk-ai-slides
path: ${{ github.workspace }}/tex_out/*.pdf
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ github.workspace }}/tex_out/*.pdf