Reprise eval + reprise S3 (#576) #690
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: Production deployment | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
docker: | |
if: "!contains(github.event.commits[0].message, '[skip ci]')" | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up QEMU | |
if: ${{ github.repository == 'linogaliana/python-datascientist' }} | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
if: ${{ github.repository == 'linogaliana/python-datascientist' }} | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to DockerHub | |
if: ${{ github.repository == 'linogaliana/python-datascientist' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
if: ${{ github.repository == 'linogaliana/python-datascientist' }} | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
env: | |
GITHUB_PAT: ${{ secrets.PAT }} | |
with: | |
file: "docker/Dockerfile" | |
push: true | |
tags: linogaliana/python-datascientist:latest | |
- | |
name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
pages: | |
name: Render-Blog | |
runs-on: ubuntu-latest | |
container: linogaliana/python-datascientist:latest | |
needs: docker | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Configure safe.directory # Workaround for actions/checkout#760 | |
run: git config --global --add safe.directory /__w/python-datascientist/python-datascientist | |
- name: Render website | |
run: | | |
rm _quarto.yml | |
cp _quarto-prod.yml _quarto.yml | |
python build/append_environment.py | |
quarto render --profile fr --to html | |
python build/sidebar.py --to english | |
quarto render --profile en --to html | |
python build/sidebar.py --to french | |
- name: Archive build as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sitedir | |
path: | | |
_site | |
- name: Publish to Pages | |
if: github.ref == 'refs/heads/main' | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name "Quarto GHA Workflow Runner" | |
quarto publish gh-pages . --no-render --no-browser | |
enonces: | |
name: Render notebooks | |
runs-on: ubuntu-latest | |
container: linogaliana/python-datascientist:latest | |
needs: docker | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Configure safe.directory # Workaround for actions/checkout#760 | |
run: | | |
git config --global --add safe.directory /__w/python-datascientist/python-datascientist | |
git config --global --add safe.directory /__w/python-datascientist/python-datascientist-notebooks | |
- shell: bash | |
run: | | |
ls | |
conda info | |
conda list | |
- name: Convert in ipynb with Quarto | |
run: | | |
export QUARTO_PROFILE=fr,en | |
rm _quarto.yml | |
cp _quarto-prod.yml _quarto.yml | |
rm content/modelisation/index.qmd # Remove file not building in ipynb | |
quarto render --profile fr --to ipynb | |
quarto render --profile en --to ipynb | |
- name: Move to expected directory | |
run: | | |
mkdir -p temp_notebooks | |
mkdir -p temp_notebooks/notebooks | |
python build/move_files.py --direction temp_notebooks/notebooks | |
quarto render content --to ipynb --execute -M echo:true | |
mkdir -p temp_notebooks/corrections | |
python build/move_files.py --direction temp_notebooks/corrections | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Source enonce | |
path: content/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Enonces | |
path: temp_notebooks/notebooks/ | |
- name: Pushes to another repository | |
uses: linogaliana/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-directory: 'temp_notebooks/' | |
destination-repository-username: 'linogaliana' | |
destination-repository-name: 'python-datascientist-notebooks' | |
user-email: [email protected] | |
destination-github-username: linogaliana | |
#target-branch: test | |
create-target-branch-if-needed: true | |
reset-repo: true | |
enonces-vscode: | |
name: Render notebooks (VSCode version) | |
runs-on: ubuntu-latest | |
container: linogaliana/python-datascientist:latest | |
needs: docker | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Configure safe.directory # Workaround for actions/checkout#760 | |
run: | | |
git config --global --add safe.directory /__w/python-datascientist/python-datascientist | |
git config --global --add safe.directory /__w/python-datascientist/python-datascientist-notebooks | |
- shell: bash | |
run: | | |
ls | |
conda info | |
conda list | |
- name: Convert in ipynb with Quarto | |
run: | | |
export QUARTO_PROFILE=fr,en | |
rm _quarto.yml | |
python ./build/nice-vscode/tweak_pipeline_vscode.py --filename _quarto-prod.yml | |
cp _quarto-prod2.yml _quarto.yml | |
rm content/modelisation/index.qmd # Remove file not building in ipynb | |
quarto render --profile fr --to ipynb | |
quarto render --profile en --to ipynb | |
- name: Move to expected directory | |
run: | | |
mkdir -p temp_notebooks | |
mkdir -p temp_notebooks/notebooks | |
python build/move_files.py --direction temp_notebooks/notebooks | |
quarto render content --to ipynb --execute -M echo:true | |
mkdir -p temp_notebooks/corrections | |
python build/move_files.py --direction temp_notebooks/corrections | |
- name: Pushes to another repository | |
uses: linogaliana/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-directory: 'temp_notebooks/' | |
destination-repository-username: 'linogaliana' | |
destination-repository-name: 'python-datascientist-notebooks-vscode' | |
user-email: [email protected] | |
destination-github-username: linogaliana | |
#target-branch: test | |
create-target-branch-if-needed: true | |
reset-repo: true | |
define-matrix: | |
runs-on: ubuntu-latest | |
needs: enonces | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'linogaliana/python-datascientist-notebooks' | |
- name: Define matrix | |
id: set-matrix | |
run: | | |
echo "::set-output name=matrix::$(find . -type f -name "*.ipynb" \ | |
! -name "_*" \ | |
! -regex '.*/getting-started/.*' \ | |
! -regex '.*/modelisation/index.*' \ | |
! -regex '.*/git/.*' \ | |
! -regex '.*/modern-ds/.*' \ | |
! -regex '.*/manipulation/04a_webscraping_TP.*' \ | |
! -regex '.*/NLP/05_exo_supp.*' \ | |
| jq -R -s -c 'split("\n")[:-1]')" | |
check: | |
needs: define-matrix | |
runs-on: ubuntu-latest | |
container: linogaliana/python-datascientist:latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
manifest: ${{ fromJson(needs.define-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'linogaliana/python-datascientist-notebooks' | |
- run: | | |
quarto render ${{ matrix.manifest }} --execute | |