more ci docs build changes
- some refactoring - add doc build tools to search pattern - build all if trigger event is not a pr
This commit is contained in:
parent
e91fb247a3
commit
87dc84af3c
62
.github/workflows/build.yml
vendored
62
.github/workflows/build.yml
vendored
@ -16,10 +16,10 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
outputs:
|
outputs:
|
||||||
docs-build: ${{ steps.set-matrix.outputs.docs-build }}
|
build-doc: ${{ steps.set-matrix.outputs.build-doc }}
|
||||||
arm-boards: ${{ steps.set-matrix.outputs.arm-boards }}
|
boards-arm: ${{ steps.set-matrix.outputs.boards-arm }}
|
||||||
riscv-boards: ${{ steps.set-matrix.outputs.riscv-boards }}
|
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
|
||||||
espressif-boards: ${{ steps.set-matrix.outputs.espressif-boards }}
|
boards-espressif: ${{ steps.set-matrix.outputs.boards-espressif }}
|
||||||
steps:
|
steps:
|
||||||
- name: Dump GitHub context
|
- name: Dump GitHub context
|
||||||
env:
|
env:
|
||||||
@ -27,9 +27,12 @@ jobs:
|
|||||||
run: echo "$GITHUB_CONTEXT"
|
run: echo "$GITHUB_CONTEXT"
|
||||||
- uses: actions/checkout@v2.2.0
|
- uses: actions/checkout@v2.2.0
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
- name: Populate selected submodules
|
||||||
|
run: git submodule update --init extmod/ lib/ tools/
|
||||||
|
- name: Fetch tags
|
||||||
|
run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
||||||
- name: CircuitPython version
|
- name: CircuitPython version
|
||||||
run: |
|
run: |
|
||||||
git describe --dirty --tags
|
git describe --dirty --tags
|
||||||
@ -38,7 +41,7 @@ jobs:
|
|||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- name: Install deps
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y eatmydata
|
sudo apt-get install -y eatmydata
|
||||||
@ -109,11 +112,11 @@ jobs:
|
|||||||
zip -9r circuitpython-stubs.zip circuitpython-stubs
|
zip -9r circuitpython-stubs.zip circuitpython-stubs
|
||||||
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs/dist/*.tar.gz s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1
|
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs/dist/*.tar.gz s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1
|
||||||
- name: "Get changes"
|
- name: "Get changes"
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
uses: dorny/paths-filter@v2
|
uses: dorny/paths-filter@v2
|
||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
list-files: json
|
list-files: json
|
||||||
base: ${{ github.ref }}
|
|
||||||
filters: |
|
filters: |
|
||||||
changed:
|
changed:
|
||||||
- '**'
|
- '**'
|
||||||
@ -134,9 +137,12 @@ jobs:
|
|||||||
run: echo "$GITHUB_CONTEXT"
|
run: echo "$GITHUB_CONTEXT"
|
||||||
- uses: actions/checkout@v2.2.0
|
- uses: actions/checkout@v2.2.0
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
- name: Populate selected submodules
|
||||||
|
run: git submodule update --init extmod/ lib/ tools/
|
||||||
|
- name: Fetch tags
|
||||||
|
run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
||||||
- name: CircuitPython version
|
- name: CircuitPython version
|
||||||
run: |
|
run: |
|
||||||
git describe --dirty --tags
|
git describe --dirty --tags
|
||||||
@ -185,15 +191,16 @@ jobs:
|
|||||||
build-doc:
|
build-doc:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
needs: test
|
needs: test
|
||||||
if: ${{ needs.test.outputs.docs-build == 'True' }}
|
if: ${{ needs.test.outputs.build-doc == 'True' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.2.0
|
- uses: actions/checkout@v2.2.0
|
||||||
with:
|
with:
|
||||||
submodules: false
|
submodules: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Populate selected submodules
|
- name: Populate selected submodules
|
||||||
run: git submodule update --init extmod/ulab
|
run: git submodule update --init extmod/
|
||||||
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
- name: Fetch tags
|
||||||
|
run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
||||||
- name: CircuitPython version
|
- name: CircuitPython version
|
||||||
run: |
|
run: |
|
||||||
git describe --dirty --tags
|
git describe --dirty --tags
|
||||||
@ -202,7 +209,7 @@ jobs:
|
|||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- name: Install deps
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y eatmydata
|
sudo apt-get install -y eatmydata
|
||||||
@ -244,8 +251,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
board: ${{ fromJSON(needs.test.outputs.arm-boards) }}
|
board: ${{ fromJSON(needs.test.outputs.boards-arm) }}
|
||||||
if: ${{ needs.test.outputs.arm-boards != '[]' }}
|
if: ${{ needs.test.outputs.boards-arm != '[]' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Python 3.8
|
- name: Set up Python 3.8
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
@ -255,8 +262,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
- name: Fetch tags
|
||||||
- name: Install deps
|
run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
||||||
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y gettext
|
sudo apt-get install -y gettext
|
||||||
pip install -r requirements-ci.txt -r requirements-dev.txt
|
pip install -r requirements-ci.txt -r requirements-dev.txt
|
||||||
@ -295,8 +303,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
board: ${{ fromJSON(needs.test.outputs.riscv-boards) }}
|
board: ${{ fromJSON(needs.test.outputs.boards-riscv) }}
|
||||||
if: ${{ needs.test.outputs.riscv-boards != '[]' }}
|
if: ${{ needs.test.outputs.boards-riscv != '[]' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Python 3.8
|
- name: Set up Python 3.8
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
@ -306,8 +314,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
- name: Fetch tags
|
||||||
- name: Install deps
|
run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
||||||
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y gettext
|
sudo apt-get install -y gettext
|
||||||
pip install -r requirements-ci.txt -r requirements-dev.txt
|
pip install -r requirements-ci.txt -r requirements-dev.txt
|
||||||
@ -346,8 +355,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
board: ${{ fromJSON(needs.test.outputs.espressif-boards) }}
|
board: ${{ fromJSON(needs.test.outputs.boards-espressif) }}
|
||||||
if: ${{ needs.test.outputs.espressif-boards != '[]' }}
|
if: ${{ needs.test.outputs.boards-espressif != '[]' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Python 3.8
|
- name: Set up Python 3.8
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
@ -357,7 +366,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
- name: Fetch tags
|
||||||
|
run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
|
||||||
- name: CircuitPython version
|
- name: CircuitPython version
|
||||||
run: git describe --dirty --tags
|
run: git describe --dirty --tags
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
@ -380,7 +390,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
|
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
|
||||||
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
|
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
|
||||||
- name: Install deps
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
source $IDF_PATH/export.sh
|
source $IDF_PATH/export.sh
|
||||||
sudo apt-get install -y gettext ninja-build
|
sudo apt-get install -y gettext ninja-build
|
||||||
|
@ -33,9 +33,12 @@ PORT_TO_ARCH = {
|
|||||||
"stm": "arm",
|
"stm": "arm",
|
||||||
}
|
}
|
||||||
|
|
||||||
changed_files = json.loads(os.environ["CHANGED_FILES"])
|
changed_files = {}
|
||||||
print("changed_files")
|
try:
|
||||||
print(changed_files)
|
changed_files = json.loads(os.environ["CHANGED_FILES"])
|
||||||
|
except json.decoder.JSONDecodeError as exc:
|
||||||
|
if exc.msg != "Expecting value":
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
def set_boards_to_build(build_all):
|
def set_boards_to_build(build_all):
|
||||||
@ -59,8 +62,8 @@ def set_boards_to_build(build_all):
|
|||||||
|
|
||||||
if not build_all:
|
if not build_all:
|
||||||
boards_to_build = set()
|
boards_to_build = set()
|
||||||
board_pattern = re.compile(r"ports\/\w+\/boards\/(\w+)\/")
|
board_pattern = re.compile(r"^ports\/\w+\/boards\/(\w+)\/")
|
||||||
port_pattern = re.compile(r"ports\/(\w+)\/")
|
port_pattern = re.compile(r"^ports\/(\w+)\/")
|
||||||
for p in changed_files:
|
for p in changed_files:
|
||||||
# See if it is board specific
|
# See if it is board specific
|
||||||
board_matches = board_pattern.search(p)
|
board_matches = board_pattern.search(p)
|
||||||
@ -90,14 +93,14 @@ def set_boards_to_build(build_all):
|
|||||||
|
|
||||||
# Set the step outputs for each architecture
|
# Set the step outputs for each architecture
|
||||||
for arch in arch_to_boards:
|
for arch in arch_to_boards:
|
||||||
print("::set-output name=" + arch + "-boards::" + json.dumps(sorted(arch_to_boards[arch])))
|
print("::set-output name=boards-" + arch + "::" + json.dumps(sorted(arch_to_boards[arch])))
|
||||||
|
|
||||||
|
|
||||||
def set_docs_to_build(build_all):
|
def set_docs_to_build(build_all):
|
||||||
doc_match = build_all
|
doc_match = build_all
|
||||||
if not build_all:
|
if not build_all:
|
||||||
doc_pattern = re.compile(
|
doc_pattern = re.compile(
|
||||||
r"extmod\/ulab\/code|ports\/\w+\/bindings|shared-bindings|\.(?:md|MD|rst|RST)$"
|
r"^(?:docs|(?:(?:extmod\/ulab|ports\/\w+\/bindings|shared-bindings)\S+\.c|conf\.py|tools\/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$"
|
||||||
)
|
)
|
||||||
for p in changed_files:
|
for p in changed_files:
|
||||||
if doc_pattern.search(p):
|
if doc_pattern.search(p):
|
||||||
@ -106,15 +109,12 @@ def set_docs_to_build(build_all):
|
|||||||
|
|
||||||
# Set the step outputs
|
# Set the step outputs
|
||||||
print("Building docs:", doc_match)
|
print("Building docs:", doc_match)
|
||||||
print("::set-output name=docs-build::" + str(doc_match))
|
print("::set-output name=build-doc::" + str(doc_match))
|
||||||
|
|
||||||
|
|
||||||
def check_changed_files():
|
def check_changed_files():
|
||||||
if not changed_files or (
|
if not changed_files:
|
||||||
os.environ.get("GITHUB_EVENT_NAME", "") == "push"
|
print("Building all docs/boards")
|
||||||
and os.environ.get("GITHUB_REPOSITORY", "") == "adafruit/circuitpython"
|
|
||||||
):
|
|
||||||
print("Building all docs/boards because of adafruit/circuitpython branch")
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print("Adding docs/boards to build based on changed files")
|
print("Adding docs/boards to build based on changed files")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user