From 309fd4bc68087d6b7c1e6da4ec548d6f83472a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Wed, 8 May 2024 12:08:22 +0100 Subject: [PATCH] .github/workflows: Splitting up into multiple reusable and dependent jobs. --- .github/workflows/apt_deps.yml | 18 ++++++++++++++++++ .github/workflows/checkout.yml | 19 +++++++++++++++++++ .github/workflows/ci.yml | 21 ++++++++++----------- 3 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/apt_deps.yml create mode 100644 .github/workflows/checkout.yml diff --git a/.github/workflows/apt_deps.yml b/.github/workflows/apt_deps.yml new file mode 100644 index 00000000..e1719e74 --- /dev/null +++ b/.github/workflows/apt_deps.yml @@ -0,0 +1,18 @@ +name: Intall apt deps + +on: + workflow_call: + inputs: + secrets: + +run-name: Installing Ubuntu dependencies + +jobs: + apt_deps: + runs-on: ubuntu-latest + + steps: + - name: install deps with prebuilt SDL (no bazel) + run: sudo apt-get update && sudo apt-get install libsdl1.2-dev libsdl-gfx1.2-dev libgmp3-dev autoconf automake libgl1-mesa-dev libglu1-mesa-dev + - name: install deps without prebuilt SDL (bazel) + run: sudo apt-get update && sudo apt-get install autoconf automake libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libasound-dev libalsaplayer-dev diff --git a/.github/workflows/checkout.yml b/.github/workflows/checkout.yml new file mode 100644 index 00000000..b8e9271e --- /dev/null +++ b/.github/workflows/checkout.yml @@ -0,0 +1,19 @@ +name: Initial clone + +on: + workflow_call: + inputs: + secrets: + +run-name: Cloning ${{ github.ref_name }} and submodules + +jobs: + initial_clone: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + #- name: Checkout submodules + # uses: textbook/git-checkout-submodule-action@2.0.0 + - name: Checkout submodules + run: git submodule init && git submodule update diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f40472f..dc8ddf28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,17 +6,18 @@ on: [push, pull_request] run-name: Run CI with ${{ github.ref_name }} by @${{ github.actor }} jobs: + checkout: + runs-on: ubuntu-latest + uses: ./.github/workflows/checkout.yml + apt_deps: + runs-on: ubuntu-latest + uses: ./.github/workflows/apt_deps.yml + cpp: runs-on: ubuntu-latest + needs: [checkout, apt_deps] steps: - - uses: actions/checkout@v1 - #- name: Checkout submodules - # uses: textbook/git-checkout-submodule-action@2.0.0 - - name: Checkout submodules - run: git submodule init && git submodule update - - name: install deps - run: sudo apt-get update && sudo apt-get install libsdl1.2-dev libsdl-gfx1.2-dev libgmp3-dev autoconf automake libgl1-mesa-dev libglu1-mesa-dev - name: install glict run: cd vendor/github.com/ivucica/glict/glict && ./autogen.sh && ./configure && make && sudo make install - name: autogen @@ -33,6 +34,7 @@ jobs: bazel: runs-on: ubuntu-latest + needs: [checkout, apt_deps] steps: # Checks-out your repository under $GITHUB_WORKSPACE, which is the CWD for # the rest of the steps @@ -60,10 +62,6 @@ jobs: run: echo Stub action merely printing a notice that there was a cache miss # More useful with e.g. npm. - - name: Checkout submodules - run: git submodule init && git submodule update - - name: install deps - run: sudo apt-get update && sudo apt-get install autoconf automake libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libasound-dev libalsaplayer-dev - name: bazel build run: bazel build //:yatc - name: bazel test @@ -72,6 +70,7 @@ jobs: bazel-buildbuddy: runs-on: ubuntu-latest + needs: checkout steps: # Checks-out your repository under $GITHUB_WORKSPACE, which is the CWD for # the rest of the steps