From 665bb3dee2cd993c772f5a50f6b026e5930a496a Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 7 May 2021 12:24:07 +1200 Subject: [PATCH] Actions: Add workflow for rendering DAG to GH Pages --- .github/workflows/gh-pages.yml | 64 ++++++++++++++++++++++++++++++++++ .gitignore | 3 ++ requirements.txt | 3 ++ 3 files changed, 70 insertions(+) create mode 100644 .github/workflows/gh-pages.yml create mode 100644 requirements.txt diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..8140e76 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,64 @@ +name: GitHub Pages + +on: + push: + branches: + - main + schedule: + - cron: "42 22 * * *" + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Upgrade pip + run: | + # install pip=>20.1 to use "pip cache dir" + python3 -m pip install --upgrade pip + + - name: Get pip cache dir + id: pip-cache + run: echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: python3 -m pip install -r ./requirements.txt + + - name: Fetch GitHub GraphQL schema + run: | + python3 -m sgqlc.introspection \ + --exclude-deprecated \ + --exclude-description \ + -H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/graphql \ + github_schema.json + + - name: Generate GitHub GraphQL schema module + run: sgqlc-codegen schema github_schema.json github_schema.py + + - name: Render core DAG + run: python3 ./zcash-core-graph.py + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ZENHUB_TOKEN: ${{ secrets.ZENHUB_TOKEN }} + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public diff --git a/.gitignore b/.gitignore index 8aca0e0..3e4aca0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ __pycache__ public + +github_schema.json +github_schema.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6b7af85 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +drest +networkx +sgqlc