From 6595d1d80ed6cd4aac297dddf558921e0526283b Mon Sep 17 00:00:00 2001 From: David Holdeman Date: Thu, 18 Jun 2020 15:31:54 -0700 Subject: [PATCH] Run gen scripts and unify firmware, simulator, and unit_tests workflows (#1506) * add workflow and scripts * select current branch * added some comments * unify build workflows for firmware, testing, and simulator * move if to steps to keep from skipping * debug * Added comment * Move simulator and unit tests back to their own files * Move config and livedoc generation to its own file * Add gen configs workflow --- .github/workflows/build-firmware.yaml | 8 ++++++ .github/workflows/build-simulator.yaml | 9 +++++- .github/workflows/build-unit-tests.yaml | 9 +++++- .github/workflows/gen-configs.yaml | 38 +++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/gen-configs.yaml diff --git a/.github/workflows/build-firmware.yaml b/.github/workflows/build-firmware.yaml index 7a13ccbbaf..2d29258b4e 100644 --- a/.github/workflows/build-firmware.yaml +++ b/.github/workflows/build-firmware.yaml @@ -112,6 +112,14 @@ jobs: with: submodules: recursive + - name: Generate Configs + working-directory: ./firmware/ + run: sh gen_config.sh + + - name: Generate Live Documentation + working-directory: ./firmware/ + run: sh gen_live_documentation.sh + # Build machines don't have arm-none-eabi gcc, so let's download it and put it on the path - name: Download & Install GCC run: | # Compiler hosted on our other git repo - avoids having to download from the nice folks at ARM every time diff --git a/.github/workflows/build-simulator.yaml b/.github/workflows/build-simulator.yaml index 9e4441c587..db45076258 100644 --- a/.github/workflows/build-simulator.yaml +++ b/.github/workflows/build-simulator.yaml @@ -4,7 +4,6 @@ on: [push,pull_request] jobs: build: - runs-on: ubuntu-latest steps: @@ -15,6 +14,14 @@ jobs: with: submodules: recursive + - name: Generate Configs + working-directory: ./firmware/ + run: sh gen_config.sh + + - name: Generate Live Documentation + working-directory: ./firmware/ + run: sh gen_live_documentation.sh + - name: Build Simulator working-directory: ./simulator/ run: make -j4 diff --git a/.github/workflows/build-unit-tests.yaml b/.github/workflows/build-unit-tests.yaml index 839a9e4b97..51489cfacd 100644 --- a/.github/workflows/build-unit-tests.yaml +++ b/.github/workflows/build-unit-tests.yaml @@ -4,7 +4,6 @@ on: [push,pull_request] jobs: build: - runs-on: ubuntu-latest steps: @@ -12,6 +11,14 @@ jobs: with: submodules: recursive + - name: Generate Configs + working-directory: ./firmware/ + run: sh gen_config.sh + + - name: Generate Live Documentation + working-directory: ./firmware/ + run: sh gen_live_documentation.sh + - name: Build Tests working-directory: ./unit_tests/ run: make -j4 diff --git a/.github/workflows/gen-configs.yaml b/.github/workflows/gen-configs.yaml new file mode 100644 index 0000000000..7af61ca8bb --- /dev/null +++ b/.github/workflows/gen-configs.yaml @@ -0,0 +1,38 @@ +name: Generate configs and live docs + +on: + push: + branches: + - master + +jobs: + generate: + runs-on: ubuntu-latest + + steps: + - name: Generate Configs + working-directory: ./firmware/ + run: sh gen_config.sh + + - name: Generate Live Documentation + working-directory: ./firmware/ + run: sh gen_live_documentation.sh + + # Commit changes and catch the error that occurs if nothing has been changed (without catching other errors) + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub build-firmware Action" + git commit -am "Auto-generated configs and docs" 2>&1 | grep -E '(nothing to commit|changed)' + + # We need to know what branch this is in order to push to the correct branch + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - name: Push configs + uses: ad-m/github-push-action@master + with: + github_token: ${{ github.token }} + branch: ${{ steps.extract_branch.outputs.branch }}