From 70e168abba5421c450cc830c9c177b2dff9e3798 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 16 Sep 2022 14:53:39 -0700 Subject: [PATCH 1/2] Split workflows into tox targets for clarity This also moves test.yaml to py2-test.yaml for parity with the py3 branch, and adds a target for generating the model support matrix, which we should also be doing. --- .github/actions/py2-tox/action.yaml | 29 ++++++++++++++++ .github/workflows/py2-test.yaml | 53 +++++++++++++++++++++++++++++ .github/workflows/test.yaml | 25 -------------- tox.ini | 4 +++ 4 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 .github/actions/py2-tox/action.yaml create mode 100644 .github/workflows/py2-test.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/actions/py2-tox/action.yaml b/.github/actions/py2-tox/action.yaml new file mode 100644 index 00000000..2ff11b16 --- /dev/null +++ b/.github/actions/py2-tox/action.yaml @@ -0,0 +1,29 @@ +name: Python2 tox runner +description: Runs tox py2 targets +inputs: + tox_target: + required: true + type: string + +runs: + using: "composite" + steps: + - name: Install dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get remove -y python3-libxml2 + sudo apt-get install -y libxml2-dev python-dev python-libxml2 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + python get-pip.py + pip --version + python -m pip install --upgrade --no-deps --force-reinstall lxml + python -m pip install \ + future \ + pep8 \ + pyserial \ + tox + - name: Run tox + shell: bash + run: | + tox -e ${{ inputs.tox_target }} diff --git a/.github/workflows/py2-test.yaml b/.github/workflows/py2-test.yaml new file mode 100644 index 00000000..d11fb15f --- /dev/null +++ b/.github/workflows/py2-test.yaml @@ -0,0 +1,53 @@ +name: Tests +on: + pull_request: + push: +jobs: + style: + name: Style checks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run tox + uses: ./.github/actions/py2-tox + with: + tox_target: style + + unit: + name: Unit tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run tox + uses: ./.github/actions/py2-tox + with: + tox_target: unit + + driver: + name: Driver tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run tox + uses: ./.github/actions/py2-tox + with: + tox_target: driver + + matrix: + name: Create support matrix + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run tox + uses: ./.github/actions/py2-tox + with: + tox_target: makesupported + - name: Archive support matrix + uses: actions/upload-artifact@v3 + with: + name: support-matrix + path: model_support.html diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index b5ac2b15..00000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Test -on: - pull_request: - push: -jobs: - test: - name: Run all tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get remove -y python3-libxml2 - sudo apt-get install -y libxml2-dev python-dev python-libxml2 - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - python get-pip.py - pip --version - python -m pip install --upgrade --no-deps --force-reinstall lxml - python -m pip install \ - future \ - pep8 \ - pyserial \ - tox - - run: tox diff --git a/tox.ini b/tox.ini index 331f5a19..f991c9cf 100644 --- a/tox.ini +++ b/tox.ini @@ -28,3 +28,7 @@ deps = future commands = python ./tools/cpep8.py + +[testenv:makesupported] +commands = + python share/make_supported.py model_support.html From 50e48ee24293c3e454b1a9d5e438b755338791df Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 16 Sep 2022 16:14:47 -0700 Subject: [PATCH 2/2] Make the py3 PR sync use a dedicated token This is needed to makes sure that actions run. --- .github/workflows/py3-pr.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/py3-pr.yaml b/.github/workflows/py3-pr.yaml index 634ef897..3e31b8ea 100644 --- a/.github/workflows/py3-pr.yaml +++ b/.github/workflows/py3-pr.yaml @@ -18,15 +18,17 @@ jobs: git checkout origin/py3 -b py3-sync git config --global user.email "bot@chirp.danplanet.com" git config --global user.name "Merge Bot" - git merge $GITHUB_SHA --allow-unrelated-histories --no-edit + git merge $GITHUB_SHA --allow-unrelated-histories --no-edit || { + git add -u + git commit --no-edit + } git checkout -b auto-py3-$GITHUB_SHA git push origin auto-py3-$GITHUB_SHA:auto-py3-$GITHUB_SHA - name: Create PR uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.PR_SYNC }} source_branch: auto-py3-${{ github.sha }} destination_branch: py3 pr_title: "[Automated] Sync master with py3" pr_body: "Automated pull request to sync py3 with changes from master" - pr_reviewer: "kk7ds"