-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (122 loc) · 4.21 KB
/
cicd.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Continuous Testing and Docs Publication
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
run-linter:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.10.13"]
steps:
- name: Checkout this repository
uses: actions/checkout@v3
with:
lfs: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run pre-commit hooks
run: |
python -m pip install pre-commit
pre-commit run --all-files --show-diff-on-failure
publish-py-package:
needs: [run-linter]
runs-on: ubuntu-latest
if: github.ref_name == 'dev'
steps:
- name: Checkout this repository
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout actions repository
uses: actions/checkout@v4
with:
repository: Exabyte-io/actions
token: ${{ secrets.BOT_GITHUB_TOKEN }}
path: actions
- name: Publish python release
uses: ./actions/py/publish
with:
python-version: 3.10.x
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
pypi-api-token: ${{ secrets.PYPI_API_TOKEN }}
# TODO: Add back when when fixed.
# build-and-deploy-docs:
# runs-on: ubuntu-20.04
# strategy:
# matrix:
# python-version: ["3.8.6"]
# env:
# ACCOUNT_ID: ${{ secrets.DEMO_ACCOUNT_ID }}
# AUTH_TOKEN: ${{ secrets.DEMO_AUTH_TOKEN }}
# MATERIALS_PROJECT_API_KEY: ${{ secrets.MATERIALS_PROJECT_API_KEY }}
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# DOCS_MAT3RA_COM_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.DOCS_MAT3RA_COM_CLOUDFRONT_DISTRIBUTION_ID }}
# defaults:
# run:
# shell: bash -l {0}
#
# steps:
# - name: Checkout this repository
# uses: actions/checkout@v3
# with:
# lfs: true
#
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
#
# - name: Install dependencies
# run: |
# set -euo pipefail
#
# python -m pip install -ve ".[localhost, docs]"
# python -m pip list
#
# - name: Export requirements.txt
# run: |
# pip install pip-tools
# for extra in colab localhost dev docs; do
# python -m piptools compile --resolver=backtracking --extra ${extra} -o requirements-${extra}.txt pyproject.toml
# done
#
# - name: Build documentation
# run : |
# mkdocs build -d site
#
# - uses: actions/upload-artifact@v3
# with:
# name: rendered-notebooks-py${{ matrix.python-version }}
# path: site
# - uses: actions/upload-artifact@v3
# with:
# name: requirements-py${{ matrix.python-version }}
# path: requirements-*.txt
#
# - name: Deploy documentation to Exabyte-io.github.io
# if: github.repository_owner == 'Exabyte-io' && github.ref_name == 'dev' && matrix.python-version == '3.8'
# # We pin to the SHA, not the tag, for security reasons.
# # https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
# uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_branch: dev-with-documentation
# publish_dir: ./site
# destination_dir: ./docs
# keep_files: true # Keep old files.
# force_orphan: false # Keep git history.
#
# - name: S3 Deploy
# if: github.repository_owner == 'Exabyte-io' && github.ref_name == 'dev' && matrix.python-version == '3.8'
# uses: Exabyte-io/action-s3-deploy@v3
# with:
# folder: site
# bucket: docs.mat3ra.com/rest-api/api-examples/rendered-notebooks
# bucket-region: us-west-2
# dist-id: ${{ env.DOCS_MAT3RA_COM_CLOUDFRONT_DISTRIBUTION_ID }}
# invalidation: /*
# no-cache: true
# private: true