mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-05 18:40:28 +00:00
more ci update (#2642)
* Circi use small docker * caching espressif docker image * only run make job on pull request or push to master * hw test run on pull request only, rename build_cmake to build.yml * enable all ci build, cmake(clang) and make(*) only run with pull_request or push to master
This commit is contained in:
parent
d707ea56b4
commit
6f47746e5f
@ -13,6 +13,8 @@ jobs:
|
|||||||
# See: https://circleci.com/developer/images/image/cimg/base
|
# See: https://circleci.com/developer/images/image/cimg/base
|
||||||
- image: cimg/base:current
|
- image: cimg/base:current
|
||||||
|
|
||||||
|
resource_class: small
|
||||||
|
|
||||||
# Add steps to the job
|
# Add steps to the job
|
||||||
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
|
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
|
||||||
steps:
|
steps:
|
||||||
|
11
.github/actions/setup_toolchain/action.yml
vendored
11
.github/actions/setup_toolchain/action.yml
vendored
@ -2,11 +2,11 @@ name: Setup Toolchain
|
|||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
toolchain:
|
toolchain:
|
||||||
|
description: 'Toolchain name'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
|
||||||
toolchain_url:
|
toolchain_url:
|
||||||
|
description: 'Toolchain URL or version'
|
||||||
required: false
|
required: false
|
||||||
type: string
|
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
build_option:
|
build_option:
|
||||||
@ -24,8 +24,10 @@ runs:
|
|||||||
|
|
||||||
- name: Pull ESP-IDF docker
|
- name: Pull ESP-IDF docker
|
||||||
if: inputs.toolchain == 'esp-idf'
|
if: inputs.toolchain == 'esp-idf'
|
||||||
run: docker pull espressif/idf:${{ inputs.toolchain_url }}
|
uses: ./.github/actions/setup_toolchain/espressif
|
||||||
shell: bash
|
with:
|
||||||
|
toolchain: ${{ inputs.toolchain }}
|
||||||
|
toolchain_url: ${{ inputs.toolchain_url }}
|
||||||
|
|
||||||
- name: Download Toolchain
|
- name: Download Toolchain
|
||||||
if: >-
|
if: >-
|
||||||
@ -33,6 +35,7 @@ runs:
|
|||||||
inputs.toolchain != 'esp-idf'
|
inputs.toolchain != 'esp-idf'
|
||||||
uses: ./.github/actions/setup_toolchain/download
|
uses: ./.github/actions/setup_toolchain/download
|
||||||
with:
|
with:
|
||||||
|
toolchain: ${{ inputs.toolchain }}
|
||||||
toolchain_url: ${{ inputs.toolchain_url }}
|
toolchain_url: ${{ inputs.toolchain_url }}
|
||||||
|
|
||||||
- name: Set toolchain option
|
- name: Set toolchain option
|
||||||
|
@ -1,29 +1,32 @@
|
|||||||
name: Download Toolchain
|
name: Download Toolchain
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
toolchain_url:
|
toolchain:
|
||||||
|
description: 'Toolchain name'
|
||||||
|
required: true
|
||||||
|
toolchain_url:
|
||||||
|
description: 'Toolchain URL'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Cache Toolchain
|
- name: Cache Toolchain
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
id: cache-toolchain
|
id: cache-toolchain-download
|
||||||
with:
|
with:
|
||||||
path: ~/cache/toolchain
|
path: ~/cache/${{ inputs.toolchain }}
|
||||||
key: ${{ runner.os }}-${{ inputs.toolchain_url }}
|
key: ${{ runner.os }}-${{ inputs.toolchain }}-${{ inputs.toolchain_url }}
|
||||||
|
|
||||||
- name: Install Toolchain
|
- name: Install Toolchain
|
||||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
if: steps.cache-toolchain-download.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/cache/toolchain
|
mkdir -p ~/cache/${{ inputs.toolchain }}
|
||||||
wget --progress=dot:mega ${{ inputs.toolchain_url }} -O toolchain.tar.gz
|
wget --progress=dot:mega ${{ inputs.toolchain_url }} -O toolchain.tar.gz
|
||||||
tar -C ~/cache/toolchain -xaf toolchain.tar.gz
|
tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set Toolchain Path
|
- name: Set Toolchain Path
|
||||||
run: |
|
run: |
|
||||||
echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
|
echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin`
|
||||||
shell: bash
|
shell: bash
|
||||||
|
42
.github/actions/setup_toolchain/espressif/action.yml
vendored
Normal file
42
.github/actions/setup_toolchain/espressif/action.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Setup ESP-IDF Toolchain
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
toolchain:
|
||||||
|
description: 'Toolchain name'
|
||||||
|
required: true
|
||||||
|
toolchain_url:
|
||||||
|
description: 'Toolchain URL or version'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- id: set-docker-image
|
||||||
|
run: |
|
||||||
|
DOCKER_IMAGE=$HOME/cache/${{ inputs.toolchain }}/docker_image.tar
|
||||||
|
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> $GITHUB_ENV
|
||||||
|
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> $GITHUB_OUTPUT
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Cache Docker Image
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-toolchain-espressif
|
||||||
|
with:
|
||||||
|
path: ${{ steps.set-docker-image.outputs.DOCKER_IMAGE }}
|
||||||
|
key: ${{ runner.os }}-${{ inputs.toolchain }}-${{ inputs.toolchain_url }}
|
||||||
|
|
||||||
|
- name: Pull and Save Docker Image
|
||||||
|
if: steps.cache-toolchain-espressif.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
docker pull espressif/idf:${{ inputs.toolchain_url }}
|
||||||
|
mkdir -p ~/cache/${{ inputs.toolchain }}
|
||||||
|
docker save -o $DOCKER_IMAGE espressif/idf:${{ inputs.toolchain_url }}
|
||||||
|
du -sh $DOCKER_IMAGE
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Load Docker Image
|
||||||
|
if: steps.cache-toolchain-espressif.outputs.cache-hit == 'true'
|
||||||
|
run: |
|
||||||
|
du -sh $DOCKER_IMAGE
|
||||||
|
docker load --input $DOCKER_IMAGE
|
||||||
|
shell: bash
|
@ -11,7 +11,7 @@ on:
|
|||||||
- 'tools/get_deps.py'
|
- 'tools/get_deps.py'
|
||||||
- 'tools/build.py'
|
- 'tools/build.py'
|
||||||
- '.github/actions/**'
|
- '.github/actions/**'
|
||||||
- '.github/workflows/build_cmake.yml'
|
- '.github/workflows/build.yml'
|
||||||
- '.github/workflows/build_util.yml'
|
- '.github/workflows/build_util.yml'
|
||||||
- '.github/workflows/ci_set_matrix.py'
|
- '.github/workflows/ci_set_matrix.py'
|
||||||
pull_request:
|
pull_request:
|
||||||
@ -24,7 +24,7 @@ on:
|
|||||||
- 'tools/get_deps.py'
|
- 'tools/get_deps.py'
|
||||||
- 'tools/build.py'
|
- 'tools/build.py'
|
||||||
- '.github/actions/**'
|
- '.github/actions/**'
|
||||||
- '.github/workflows/build_cmake.yml'
|
- '.github/workflows/build.yml'
|
||||||
- '.github/workflows/build_util.yml'
|
- '.github/workflows/build_util.yml'
|
||||||
- '.github/workflows/ci_set_matrix.py'
|
- '.github/workflows/ci_set_matrix.py'
|
||||||
concurrency:
|
concurrency:
|
||||||
@ -67,6 +67,10 @@ jobs:
|
|||||||
- 'arm-gcc'
|
- 'arm-gcc'
|
||||||
- 'msp430-gcc'
|
- 'msp430-gcc'
|
||||||
- 'riscv-gcc'
|
- 'riscv-gcc'
|
||||||
|
if: >-
|
||||||
|
matrix.toolchain != 'arm-clang' ||
|
||||||
|
github.event_name == 'pull_request' ||
|
||||||
|
(github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||||
with:
|
with:
|
||||||
build-system: 'cmake'
|
build-system: 'cmake'
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
@ -77,6 +81,9 @@ jobs:
|
|||||||
# Build Make
|
# Build Make
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
make:
|
make:
|
||||||
|
if: >-
|
||||||
|
github.event_name == 'pull_request' ||
|
||||||
|
(github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||||
needs: set-matrix
|
needs: set-matrix
|
||||||
uses: ./.github/workflows/build_util.yml
|
uses: ./.github/workflows/build_util.yml
|
||||||
strategy:
|
strategy:
|
9
.github/workflows/build_iar.yml
vendored
9
.github/workflows/build_iar.yml
vendored
@ -2,15 +2,6 @@ name: Build IAR
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
- 'examples/**'
|
|
||||||
- 'lib/**'
|
|
||||||
- 'hw/**'
|
|
||||||
- 'tools/get_deps.py'
|
|
||||||
- 'test/hil/**'
|
|
||||||
- '.github/workflows/build_iar.yml'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
paths:
|
paths:
|
||||||
|
10
.github/workflows/hil_test.yml
vendored
10
.github/workflows/hil_test.yml
vendored
@ -2,16 +2,6 @@ name: Hardware Test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
- 'examples/**'
|
|
||||||
- 'lib/**'
|
|
||||||
- 'hw/**'
|
|
||||||
- 'test/hil/**'
|
|
||||||
- 'tools/get_deps.py'
|
|
||||||
- '.github/actions/**'
|
|
||||||
- '.github/workflows/hil_test.yml'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
paths:
|
paths:
|
||||||
|
@ -242,10 +242,12 @@ def main():
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('families', nargs='*', default=[], help='Families to fetch')
|
parser.add_argument('families', nargs='*', default=[], help='Families to fetch')
|
||||||
parser.add_argument('-b', '--board', action='append', default=[], help='Boards to fetch')
|
parser.add_argument('-b', '--board', action='append', default=[], help='Boards to fetch')
|
||||||
|
parser.add_argument('--print', action='store_true', help='Print commit hash only')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
families = args.families
|
families = args.families
|
||||||
boards = args.board
|
boards = args.board
|
||||||
|
print_only = args.print
|
||||||
|
|
||||||
if len(families) == 0 and len(boards) == 0:
|
if len(families) == 0 and len(boards) == 0:
|
||||||
print("Warning: family and board are not specified, only fetching mandatory dependencies.")
|
print("Warning: family and board are not specified, only fetching mandatory dependencies.")
|
||||||
@ -268,6 +270,13 @@ def main():
|
|||||||
if f in deps_optional[d][2]:
|
if f in deps_optional[d][2]:
|
||||||
deps.append(d)
|
deps.append(d)
|
||||||
|
|
||||||
|
if print_only:
|
||||||
|
pvalue = {}
|
||||||
|
for d in deps:
|
||||||
|
commit = deps_all[d][1]
|
||||||
|
pvalue[d] = commit
|
||||||
|
print(pvalue)
|
||||||
|
else:
|
||||||
with Pool() as pool:
|
with Pool() as pool:
|
||||||
status = sum(pool.map(get_a_dep, deps))
|
status = sum(pool.map(get_a_dep, deps))
|
||||||
return status
|
return status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user