From 4707002267990f4c526ea4201e90d25df0662c20 Mon Sep 17 00:00:00 2001 From: Timothy Stewart Date: Sun, 21 Jan 2024 22:35:47 -0600 Subject: [PATCH] fix(ci): adjusting cache steps --- .github/add-boxes.sh | 24 ----------------------- .github/workflows/cache.yml | 38 ++++++++++++++++++------------------- .github/workflows/lint.yml | 4 ++-- .github/workflows/test.yml | 33 ++++++++++---------------------- 4 files changed, 31 insertions(+), 68 deletions(-) delete mode 100755 .github/add-boxes.sh diff --git a/.github/add-boxes.sh b/.github/add-boxes.sh deleted file mode 100755 index 62894f0..0000000 --- a/.github/add-boxes.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# add-boxes.sh -# list add boxes on system and add -# already present on the system. - -set -euo pipefail - -PROVIDER=virtualbox - -# Read the boxes that are currently present on the system (for the current provider) -present_boxes=$( - (vagrant box list | - grep "${PROVIDER}" | # Filter by boxes available for the current provider - awk '{print $1;}' | # The box name is the first word in each line - sort | - uniq) || - echo "" # In case any of these commands fails, just use an empty list -) - -# Add all boxes - echo "${present_boxes}" | while IFS= read -r box; do - vagrant box add --provider "${PROVIDER}" "${box}" - done diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 6c8a376..f26f63a 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -5,7 +5,7 @@ on: jobs: molecule: name: cache - runs-on: macos-12 + runs-on: macos-13 env: PYTHON_VERSION: "3.11" @@ -58,26 +58,26 @@ jobs: restore-keys: | vagrant-boxes - # - name: Configure Homebrew cache - # uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # 4.0 - # id: cache-homebrew - # with: - # path: | - # ~/Library/Caches/Homebrew - # key: brew-${{ hashFiles('./Brewfile') }} - # restore-keys: brew- + - name: Configure Homebrew cache + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # 4.0 + id: cache-homebrew + with: + path: | + ~/Library/Caches/Homebrew + key: brew-${{ hashFiles('./Brewfile') }} + restore-keys: brew- - # - name: Update Homebrew - # if: | # only run if false since this is just a cache step - # steps.cache-homebrew.outputs.cache-hit != 'true' || steps.cache-homebrew.outputs.cache-hit != 'true' - # run: | - # brew update --preinstall + - name: Update Homebrew + if: | # only run if false since this is just a cache step + steps.cache-homebrew.outputs.cache-hit != 'true' || steps.cache-homebrew.outputs.cache-hit != 'true' + run: | + brew update --preinstall - # - name: Install Homebrew dependencies - # if: | # only run if false since this is just a cache step - # steps.cache-homebrew.outputs.cache-hit != 'true' || steps.cache-homebrew.outputs.cache-hit != 'true' - # run: | - # env HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade --file ./Brewfile + - name: Install Homebrew dependencies + if: | # only run if false since this is just a cache step + steps.cache-homebrew.outputs.cache-hit != 'true' || steps.cache-homebrew.outputs.cache-hit != 'true' + run: | + env HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade --file ./Brewfile - name: Download Vagrant boxes for all scenarios # To save some cache space, all scenarios share the same cache key. diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8bb1f84..580d0ce 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,7 +5,7 @@ on: jobs: pre-commit-ci: name: Pre-Commit - runs-on: macos-12 + runs-on: macos-13 env: PYTHON_VERSION: "3.11" @@ -46,7 +46,7 @@ jobs: ensure-pinned-actions: name: Ensure SHA Pinned Actions - runs-on: macos-12 + runs-on: macos-13 steps: - name: Checkout code uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v3 2.5.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d03e4cc..27cdd5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ on: jobs: molecule: name: Molecule - runs-on: macos-12 + runs-on: macos-13 strategy: matrix: scenario: @@ -22,25 +22,19 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Restore Ansible cache + - name: Restore Homebrew cache uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # 4.0 with: - path: ~/.ansible/collections - key: ansible-${{ hashFiles('collections/requirements.yml') }} + path: ~/Library/Caches/Homebrew + key: brew-${{ hashFiles('./Brewfile') }} - # - name: Restore Homebrew cache - # uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # 4.0 - # with: - # path: ~/Library/Caches/Homebrew - # key: brew-${{ hashFiles('./Brewfile') }} + - name: Update Homebrew + run: | + brew update --preinstall - # - name: Update Homebrew - # run: | - # brew update --preinstall - - # - name: Install Homebrew dependencies - # run: | - # env HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade --file ./Brewfile + - name: Install Homebrew dependencies + run: | + env HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade --file ./Brewfile - name: Restore vagrant Boxes cache uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # 4.0 @@ -57,9 +51,6 @@ jobs: * fdad:bad:ba55::/64 EOF - - name: Add Vagrant Boxes - run: ./.github/add-boxes.sh - - name: Install dependencies run: | echo "::group::Upgrade pip" @@ -70,10 +61,6 @@ jobs: python3 -m pip install -r requirements.txt echo "::endgroup::" - echo "::group::Install Ansible role requirements from collections/requirements.yml" - ansible-galaxy install -r collections/requirements.yml - echo "::endgroup::" - - name: Test with molecule run: molecule test --scenario-name ${{ matrix.scenario }} timeout-minutes: 90