Skip to content

Commit

Permalink
Replace cache actions with artifacts actions
Browse files Browse the repository at this point in the history
Cache save and restore actions currently don't work between Linux and
macOS runners, so use artifact upload and download actions instead.
  • Loading branch information
tuxji committed Feb 21, 2023
1 parent 8a9c991 commit 35bb1cd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/assemble-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
jobs:

# assemble-files job:
# - Downloads files for rack-box builds
# - Packages files for rack-box builds
# - Saves files in cache for rack-box builds
# - Downloads certain files for rack-box builds
# - Packages certain files for rack-box builds
# - Uploads rack-box files to artifacts

assemble-files:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -127,9 +127,9 @@ jobs:
run: |
docker container stop $(docker container ls -qf ancestor=gehighassurance/rack-box:dev)
- name: Save rack-box files to cache
uses: actions/cache/save@v3
- name: Upload rack-box files to artifacts
uses: actions/upload-artifact@v3
with:
name: rack-box-files
path: RACK/rack-box/files
key: files-${{ github.sha }}-${{ github.run_id }}
enableCrossOsArchive: true
retention-days: 1
9 changes: 4 additions & 5 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
jobs:

# build-docker-image job:
# - Downloads rack-box files from artifacts
# - Builds rack-box docker image
# - Pushes docker image to Docker Hub

Expand All @@ -28,13 +29,11 @@ jobs:
repository: ge-high-assurance/RACK
path: RACK

- name: Restore rack-box files from cache
uses: actions/cache/restore@v3
- name: Download rack-box files from artifacts
uses: actions/download-artifact@v3
with:
name: rack-box-files
path: RACK/rack-box/files
key: files-${{ github.sha }}-${{ github.run_id }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Build rack-box docker image
run: |
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/build-virtual-machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ on:
jobs:

# build-virtual-machine job:
# - Downloads rack-box files from artifacts
# - Builds rack-box virtual machine
# - Uploads virtual machine to workflow or release
# - Uploads virtual machine to artifacts or releases

build-virtual-machine:
runs-on: macos-12
Expand All @@ -24,13 +25,11 @@ jobs:
repository: ge-high-assurance/RACK
path: RACK

- name: Restore rack-box files from cache
uses: actions/cache/restore@v3
- name: Download rack-box files from artifacts
uses: actions/download-artifact@v3
with:
name: rack-box-files
path: RACK/rack-box/files
key: files-${{ github.sha }}-${{ github.run_id }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Download base box for virtual machine
run: |
Expand All @@ -52,7 +51,7 @@ jobs:
split -b 1500m rack-box-${{ inputs.version }}.zip rack-box-${{ inputs.version }}.zip
rm rack-box-${{ inputs.version }}.zip
- name: Upload split virtual machine to workflow
- name: Upload virtual machine to artifacts
uses: actions/upload-artifact@v3
if: github.event_name != 'release'
with:
Expand All @@ -65,7 +64,7 @@ jobs:
# against it; replace it with "gh release upload" if CI fails
# run: gh release upload ${{ github.event.release.tag_name }} RACK/rack-box/GitHub-Release-README.md RACK/rack-box/rack-box-${{ inputs.version }}.zip* --clobber

- name: Upload split virtual machine to release
- name: Upload virtual machine to releases
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
uses: ./.github/workflows/assemble-files.yml

# test job:
# - Downloads rack-box files from artifacts
# - Installs rack-box on runner
# - Runs rack-box tests

test:
Expand All @@ -75,13 +77,11 @@ jobs:
repository: ge-high-assurance/RACK
path: RACK

- name: Restore rack-box files from cache
uses: actions/cache/restore@v3
- name: Download rack-box files from artifacts
uses: actions/download-artifact@v3
with:
name: rack-box-files
path: RACK/rack-box/files
key: files-${{ github.sha }}-${{ github.run_id }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -99,7 +99,7 @@ jobs:
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install rack-box files on runner
- name: Install rack-box on runner
run: |
mkdir -p /tmp/files
for f in RACK/rack-box/files/*; do
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit
# Look to see if there is a cache hit for cvstomd
key: ${{ runner.os }}-pip-csvtomd
restore-keys: |
${{ runner.os }}-pip-
Expand Down

0 comments on commit 35bb1cd

Please sign in to comment.