build #319
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
repository_dispatch: | |
types: [build] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_EVENT_NAME: ${{ github.event_name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
group: | |
- "census" | |
- "validator" | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: ".github/workflows/build.yml" # See dependencies below | |
- name: cache pre-commit | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Cache postgres | |
id: cache-postgres | |
uses: actions/cache@v3 | |
with: | |
path: ~/postgres.tar | |
key: cache-postgres-0 | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-central-1 | |
- name: Cache postgres miss | |
if: steps.cache-postgres.outputs.cache-hit != 'true' | |
run: docker pull postgres:latest && docker image save postgres:latest --output ~/postgres.tar | |
- name: Cache postgres use | |
if: steps.cache-postgres.outputs.cache-hit == 'true' | |
run: docker image load --input ~/postgres.tar | |
- run: | | |
python -m pip install -U pip | |
pip install -U laminci | |
sudo apt-get -y install graphviz | |
- run: nox -s lint | |
if: ${{ matrix.python-version == '3.10' && matrix.group == 'validator' }} | |
- run: nox -s "install(group='${{ matrix.group }}')" | |
- run: nox -s "build(group='${{ matrix.group }}')" | |
- uses: voxmedia/github-action-slack-notify-build@v1 | |
if: ${{ success() && github.event_name == 'repository_dispatch' }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_GITHUB_ACTION }} | |
with: | |
channel: lamindb-mirror-github-actions | |
status: SUCCESS | |
color: good | |
- uses: voxmedia/github-action-slack-notify-build@v1 | |
if: ${{ failure() && github.event_name == 'repository_dispatch' }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_GITHUB_ACTION }} | |
with: | |
channel: lamindb-mirror-github-actions | |
status: FAILURE | |
color: danger | |
docs: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: checkout lndocs | |
uses: actions/checkout@v3 | |
with: | |
repository: laminlabs/lndocs | |
ssh-key: ${{ secrets.READ_LNDOCS }} | |
path: lndocs | |
ref: main | |
- uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
cache-dependency-path: ".github/workflows/build.yml" | |
- name: install Python deps | |
run: | | |
python -m pip install --upgrade pip | |
pip install laminci | |
- run: nox -s "install(group='docs')" | |
- uses: actions/download-artifact@v2 | |
- run: nox -s docs | |
- uses: nwtgck/[email protected] | |
with: | |
publish-dir: "_build/html" | |
production-deploy: ${{ github.event_name == 'push' }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
enable-commit-comment: false | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
notify: | |
if: always() | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: voxmedia/github-action-slack-notify-build@v1 | |
if: ${{ needs.test.result == 'success' && github.event_name == 'repository_dispatch' }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_GITHUB_ACTION }} | |
with: | |
channel: lamindb-mirror-github-actions | |
status: SUCCESS | |
color: good | |
- uses: voxmedia/github-action-slack-notify-build@v1 | |
if: ${{ needs.test.result == 'failure' && github.event_name == 'repository_dispatch' }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_GITHUB_ACTION }} | |
with: | |
channel: lamindb-mirror-github-actions | |
status: FAILURE | |
color: danger |