Update census 2010 example #776
Workflow file for this run
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
# Called when someone is committing in a PR. | |
# This runs: | |
# - setup: to find out which projects changed compared to main | |
# - test: test the changed projects in a matrix | |
# - build: build the changed projects in a matrix, this creates a branch to save the evaluated projects | |
# - docs: build the dev docs, collecting the evaluated projects from `evaluated` and the new branch | |
name: test+build+doc | |
on: | |
pull_request: | |
branches: | |
- "main" | |
# Cancel previous runs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# This permissions will propagate to the workflows called by this workflow. | |
permissions: | |
# To allow the build workflow to push to the origin, when actions/checkout is used. | |
contents: write | |
# To allow the docs workflow to submit a comment using thollander/actions-comment-pull-request | |
pull-requests: write | |
# Project file changes: | |
# - Always validate it | |
# - Website only metadata -> Skip test/build | |
# - Deployment metadata (examples_config.deployments, commands) -> We should redeploy, but skip test/build/doc | |
# - Docs is special, it's just to pull the `evaluated` branch, and this is only useful to get the built notebooks | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
timeout-minutes: 10 | |
outputs: | |
changedprojects: ${{ steps.set-list.outputs.changedprojects }} | |
removedprojects: ${{ steps.set-list.outputs.removedprojects }} | |
changedprojectsfile: ${{ steps.set-list.outputs.changedprojectsfile }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 | |
# - uses: hmarr/debug-action@v2 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: install deps | |
# Minimal required deps to run the following script | |
run: pip install doit pyyaml | |
- name: infer project list | |
id: set-list | |
run: | | |
CHANGES=$(doit util_list_changed_dirs_with_main --exclude-website-metadata --exclude-deployments-metadata | tail -n -1) | |
CHANGEDPROJECTS=$(echo $CHANGES | jq -c -r '.changed') | |
REMOVEDPROJECTS=$(echo $CHANGES | jq -c -r '.removed') | |
echo "Changed projects: $CHANGEDPROJECTS" | |
echo "Removed projects: $REMOVEDPROJECTS" | |
if [ "$CHANGEDPROJECTS" != "[]" -a "$REMOVEDPROJECTS" != "[]" ]; then | |
echo "No support for removing and updating projects together" | |
echo "Open a PR that just remove project" | |
exit 1 | |
fi | |
echo "CHANGEDPROJECTS=$CHANGEDPROJECTS" >> $GITHUB_OUTPUT | |
echo "REMOVEDPROJECTS=$REMOVEDPROJECTS" >> $GITHUB_OUTPUT | |
# There's logic to skip testing/building when only some metadata in the | |
# project file changes. In these cases, we still want to validate the project file. | |
- name: validate project files | |
run: | | |
CHANGESPROJECTSFILE=$(doit util_list_changed_dirs_with_main --only-project-file | tail -n -1) | |
CHANGEDPROJECTSFILE=$(echo $CHANGESPROJECTSFILE | jq -c -r '.changed') | |
echo "Changed projects (project file only): $CHANGEDPROJECTSFILE" | |
if [ "$CHANGEDPROJECTSFILE" != "[]" ]; then | |
items=$(echo $CHANGEDPROJECTSFILE | jq -c -r '.[]') | |
for item in ${items[@]}; do | |
doit validate_project_file:$item | |
done | |
fi | |
test: | |
needs: setup | |
uses: ./.github/workflows/test.yml | |
with: | |
projects: ${{ needs.setup.outputs.changedprojects }} | |
type: workflow_call | |
secrets: inherit | |
build: | |
needs: [setup, test] | |
uses: ./.github/workflows/build.yml | |
with: | |
projects: ${{ needs.setup.outputs.changedprojects }} | |
type: workflow_call | |
branch: ${{ github.event.pull_request.head.ref }} | |
docs: | |
needs: [setup, build] | |
if: needs.build.result == 'success' || needs.build.result == 'skipped' | |
uses: ./.github/workflows/docs.yml | |
with: | |
target: dev | |
branch: ${{ github.event.pull_request.head.ref }} | |
changedprojects: ${{ needs.setup.outputs.changedprojects }} | |
removedprojects: ${{ needs.setup.outputs.removedprojects }} | |
type: workflow_call | |
secrets: inherit |