From a0ceeff0145101ffb7c8407dcc203d858393601d Mon Sep 17 00:00:00 2001 From: Roddy Rappaport Date: Sat, 21 Dec 2024 10:04:20 +0200 Subject: [PATCH] Added parallel build to PR workflow Using a matrix and job separation we can make the architectures compile parallel to eachother, hopefully reducing the time required for builds and also simplifying the process of building a single architecture. A problem that we encountered is that with Python the resulting packed tars are very large. Each release is in the order of tens of megabytes. Using artifacts in our pipeline can easily make us surpass the maximum size limit for free GitHub accounts (500 MB). Because of this, we use the regular non-parallel pipeline for release build. Releasing the version from the same job the build was performed in allows us to directly access the build files instead of using artifacts. Separated release and MR pipelines. --- .github/workflows/pr-pipeline.yaml | 24 +++++++++++++++++++ .../{pipeline.yaml => release-pipeline.yaml} | 19 ++++----------- 2 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/pr-pipeline.yaml rename .github/workflows/{pipeline.yaml => release-pipeline.yaml} (56%) diff --git a/.github/workflows/pr-pipeline.yaml b/.github/workflows/pr-pipeline.yaml new file mode 100644 index 0000000..a137131 --- /dev/null +++ b/.github/workflows/pr-pipeline.yaml @@ -0,0 +1,24 @@ +name: gdb-static-pr-pipeline + +on: + pull_request: + branches: + - '*' + +jobs: + build: + strategy: + matrix: + architecture: ["x86_64", "arm", "aarch64", "powerpc", "mips", "mipsel"] + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install dependencies + run: sudo apt-get install -y wget + + - name: Build + run: make build-${{ matrix.architecture }} -j$((`nproc`+1)) diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/release-pipeline.yaml similarity index 56% rename from .github/workflows/pipeline.yaml rename to .github/workflows/release-pipeline.yaml index dd37e65..671b05a 100644 --- a/.github/workflows/pipeline.yaml +++ b/.github/workflows/release-pipeline.yaml @@ -1,17 +1,15 @@ -name: gdb-static-pipeline +name: gdb-static-release-pipeline on: - pull_request: - branches: - - '*' push: tags: - 'v*' +# Use a non-parallel single job pipeline because artifacts weigh too much. Instead, +# simply build the files in the same job they are released. jobs: - build: + build_and_publish: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 with: @@ -26,14 +24,7 @@ jobs: - name: Pack run: make pack - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: gdb-static - path: build/artifacts/gdb-static*.tar.gz - - name: Publish release - if: github.event_name == 'push' uses: softprops/action-gh-release@v2 with: - files: build/artifacts/gdb-static*.tar.gz + files: build/artifacts/gdb-static*.tar.gz \ No newline at end of file