don't cache deps build when pushing tag or opening pull requests

This commit is contained in:
otavepto 2023-12-20 15:37:05 +02:00 committed by otavepto
parent 62afce33ca
commit 0a50c37584
2 changed files with 39 additions and 54 deletions

View File

@ -25,23 +25,28 @@ env:
PACKAGE_ROOT_PATH: "build-linux/package"
jobs:
dependencies:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout branch
uses: actions/checkout@v4
### deps
- name: Lookup cache for deps
id: emu-deps-cache-step
# !tag && !pull_request
# also you could use this: github.event_name != 'pull_request'
if: |
!startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/pull/')
uses: actions/cache@v3
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
lookup-only: true
# we need the repo to build the deps since it has the build scripts
- name: Checkout branch
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: Clone third-party deps (deps/linux)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
@ -61,47 +66,33 @@ jobs:
shell: bash
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh
build:
needs: [ dependencies ]
runs-on: ubuntu-22.04
steps:
- name: Checkout branch
uses: actions/checkout@v4
### deps
- name: Grab cache for deps
id: emu-deps-cache-step
uses: actions/cache@v3
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
fail-on-cache-miss: true
## mandatory Linux packages, installed via sudo apt install ...
- name: Install required packages
shell: bash
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -packages_only
## extra helpers/tools, these are not built inside the deps build dir
- name: Clone third-party build helpers (build/linux)
uses: actions/checkout@v4
with:
ref: 'third-party/build/linux'
path: "${{env.THIRD_PARTY_BASE_DIR}}/build/linux"
### build + upload release
### build (release mode)
- name: Build release mode
continue-on-error: true
shell: bash
working-directory: ${{ github.workspace }}
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh release"
### package (release mode)
- name: Package build (release)
if: success()
shell: bash
working-directory: ${{ github.workspace }}
run: sudo chmod 77 package_linux.sh && sudo ./package_linux.sh release
### upload artifact/package to github Actions (release mode)
- name: Upload build pacakge (release)
if: success()
uses: actions/upload-artifact@v4
@ -112,19 +103,21 @@ jobs:
compression-level: 9
retention-days: 1
### build + upload debug
### build (debug mode)
- name: Build debug mode
continue-on-error: true
shell: bash
working-directory: ${{ github.workspace }}
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh debug"
### package (debug mode)
- name: Package build (debug)
if: success()
shell: bash
working-directory: ${{ github.workspace }}
run: sudo chmod 77 package_linux.sh && sudo ./package_linux.sh debug
### upload artifact/package to github Actions (debug mode)
- name: Upload build pacakge (debug)
if: success()
uses: actions/upload-artifact@v4
@ -135,6 +128,7 @@ jobs:
compression-level: 9
retention-days: 1
### release (debug + release modes) if this is a tag push
- name: Release
if: success() && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1

View File

@ -24,22 +24,25 @@ env:
PACKAGE_ROOT_PATH: "build-win/package"
jobs:
dependencies:
build:
runs-on: windows-2022
steps:
- name: Checkout branch
uses: actions/checkout@v4
### deps
- name: Lookup cache for deps
id: emu-deps-cache-step
# !tag && !pull_request
# also you could use this: github.event_name != 'pull_request'
if: |
!startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/pull/')
uses: actions/cache@v3
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
lookup-only: true
# we need the repo to build the deps since it has the build scripts
- name: Checkout branch
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: Clone third-party deps (deps/win)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
@ -68,24 +71,7 @@ jobs:
working-directory: ${{ github.workspace }}
run: build_win_deps.bat
build:
needs: [ dependencies ]
runs-on: windows-2022
steps:
- name: Checkout branch
uses: actions/checkout@v4
### deps
- name: Grab cache for deps
id: emu-deps-cache-step
uses: actions/cache@v3
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
fail-on-cache-miss: true
## extra helpers/tools, these are not built inside the deps build dir
- name: Clone third-party build helpers (common/win)
uses: actions/checkout@v4
with:
@ -98,19 +84,21 @@ jobs:
ref: 'third-party/deps/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win"
### build + upload release
### build (release mode)
- name: Build release mode
continue-on-error: true
shell: cmd
working-directory: ${{ github.workspace }}
run: build_win.bat release
### package (release mode)
- name: Package build (release)
if: success()
shell: cmd
working-directory: ${{ github.workspace }}
run: package_win.bat release
### upload artifact/package to github Actions (release mode)
- name: Upload build pacakge (release)
if: success()
uses: actions/upload-artifact@v4
@ -121,19 +109,21 @@ jobs:
compression-level: 9
retention-days: 1
### build + upload debug
### build (debug mode)
- name: Build debug mode
continue-on-error: true
shell: cmd
working-directory: ${{ github.workspace }}
run: build_win.bat debug
### package (debug mode)
- name: Package build (debug)
if: success()
shell: cmd
working-directory: ${{ github.workspace }}
run: package_win.bat debug
### upload artifact/package to github Actions (debug mode)
- name: Upload build pacakge (debug)
if: success()
uses: actions/upload-artifact@v4
@ -144,6 +134,7 @@ jobs:
compression-level: 9
retention-days: 1
### release (debug + release modes) if this is a tag push
- name: Release
if: success() && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1