diff --git a/.github/workflows/ci.yml b/.github/workflows/_github_actions/ci.yml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/_github_actions/ci.yml diff --git a/.github/workflows/ci-ec2-gpu.yml b/.github/workflows/ci-ec2-gpu.yml new file mode 100644 index 00000000..82125eaa --- /dev/null +++ b/.github/workflows/ci-ec2-gpu.yml @@ -0,0 +1,92 @@ +name: Build Project [using jupyter-book] +on: [push] +jobs: + deploy-runner: + runs-on: ubuntu-latest + steps: + - uses: iterative/setup-cml@v1 + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Deploy runner on EC2 + env: + REPO_TOKEN: ${{ secrets.QUANTECON_SERVICES_PAT }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: | + cml runner launch \ + --cloud=aws \ + --cloud-region=us-west-2 \ + --cloud-type=p2.xlarge \ + --labels=cml-gpu + preview: + needs: deploy-runner + runs-on: [self-hosted, cml-gpu] + container: + image: docker://iterativeai/cml:latest-gpu + options: --gpus all + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup Anaconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + auto-activate-base: true + miniconda-version: 'latest' + python-version: 3.9 + environment-file: environment.yml + activate-environment: quantecon + - name: Install latex dependencies + run: | + sudo apt-get -qq update + sudo apt-get install -y \ + texlive-latex-recommended \ + texlive-latex-extra \ + texlive-fonts-recommended \ + texlive-fonts-extra \ + texlive-xetex \ + latexmk \ + xindy + - name: Display Conda Environment Versions + shell: bash -l {0} + run: conda list + - name: Display Pip Versions + shell: bash -l {0} + run: pip list + - name: Download "build" folder (cache) + uses: dawidd6/action-download-artifact@v2 + with: + workflow: cache.yml + branch: main + name: build-cache + path: _build + # Build Assets (Download Notebooks and PDF via LaTeX) + - name: Build Download Notebooks (sphinx-tojupyter) + shell: bash -l {0} + run: | + jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going + mkdir -p _build/html/_notebooks + cp -u _build/jupyter/*.ipynb _build/html/_notebooks + - name: Build PDF from LaTeX + shell: bash -l {0} + run: | + jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going + mkdir _build/html/_pdf + cp -u _build/latex/*.pdf _build/html/_pdf + # Final Build of HTML + - name: Build HTML + shell: bash -l {0} + run: | + jb build lectures --path-output ./ -n -W --keep-going + - name: Preview Deploy to Netlify + uses: nwtgck/actions-netlify@v1.1 + with: + publish-dir: '_build/html/' + production-branch: main + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Preview Deploy from GitHub Actions" + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}