Skip to content

Commit

Permalink
github: modernize workflows, avoid unneeded cache save
Browse files Browse the repository at this point in the history
  • Loading branch information
mporsch committed Dec 17, 2024
1 parent a983668 commit 0a7135b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: cache externals restore
id: cache-externals-restore
if: matrix.libressl
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: build/external/libressl/install
key: ${{ matrix.os }}-externals-${{ hashFiles('external/CMakeLists.txt') }}

- name: configure externals
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true')
run: >
Expand All @@ -37,16 +39,18 @@ jobs:
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }}
-B build/external
-S external
- name: build externals
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true')
run: cmake --build build/external --config ${{ matrix.build_type }}

- name: cache externals save
id: cache-externals-save
if: matrix.libressl
uses: actions/cache/save@v3
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true')
uses: actions/cache/save@v4
with:
path: build/external/libressl/install
key: ${{ steps.cache-externals-restore.outputs.cache-primary-key }}

- name: configure
run: >
cmake
Expand All @@ -60,14 +64,17 @@ jobs:
${{ matrix.libressl }}
-B build
-S .
- name: build and install
run: cmake --build build --target install --config ${{ matrix.build_type }}

- name: zip
uses: vimtor/action-zip@v1.2
with:
files: >
build/install/
dest: ${{ matrix.release_zip }}

- name: release
uses: softprops/action-gh-release@v2
with:
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: cache externals restore
id: cache-externals-restore
if: matrix.libressl
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: build/external/libressl/install
key: ${{ matrix.os }}-externals-${{ hashFiles('external/CMakeLists.txt') }}

- name: configure externals
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true')
run: >
Expand All @@ -68,16 +70,18 @@ jobs:
-S external
${{ matrix.generator }}
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.type }}
- name: build externals
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true')
run: cmake --build build/external --config ${{ matrix.type }}

- name: cache externals save
id: cache-externals-save
if: matrix.libressl
uses: actions/cache/save@v3
if: matrix.libressl && (steps.cache-externals-restore.outputs.cache-hit != 'true')
uses: actions/cache/save@v4
with:
path: build/external/libressl/install
key: ${{ steps.cache-externals-restore.outputs.cache-primary-key }}

- name: configure library
run: >
cmake
Expand All @@ -88,8 +92,10 @@ jobs:
-DWITH_TLS:BOOL=ON
${{ matrix.libressl }}
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.type }}
- name: build library
run: cmake --build build --config ${{ matrix.type }}

- name: build & run tests
env:
CTEST_OUTPUT_ON_FAILURE: 1
Expand Down

0 comments on commit 0a7135b

Please sign in to comment.