diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..f798d0a --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,60 @@ +name: Workflows + +on: [push, pull_request] + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + - name: Shellcheck Version Check + run: shellcheck -V + - name: Run ShellCheck + run: shellcheck mkRAMDisk.sh + + mount-and-test: + runs-on: macos-14 + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: Goss downloaded cache + uses: actions/cache/restore@v4 + with: + path: /tmp/goss + key: mkramdisk-goss + + - name: Download Goss + run: | + curl -L https://github.com/goss-org/goss/releases/download/v0.4.6/goss-darwin-arm64 \ + -o /tmp/goss && \ + chmod +x /tmp/goss + + - name: Store goss cache + uses: actions/cache/save@v4 + with: + path: /tmp/goss + key: mkramdisk-goss + + - name: Run mkRAMDisk.sh + run: | + ./mkRAMDisk.sh + + - name: Run goss (mkRAMDisk.sh) + run: | + /tmp/goss -g tests/goss_mount.yaml validate + env: + GOSS_USE_ALPHA: 1 + + - name: Run ejectRAMDisk.sh + run: | + mount && \ + ls /Volumes && \ + ./ejectRAMDisk.sh + + - name: Run goss (ejectRAMDisk.sh) + run: | + /tmp/goss -g tests/goss_eject.yaml validate + env: + GOSS_USE_ALPHA: 1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 33e9be0..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: shellcheck - -on: [push, pull_request] - -jobs: - shellcheck: - runs-on: ubuntu-18.04 - steps: - - name: checkout - uses: actions/checkout@v2 - - name: Shellcheck Version Check - run: shellcheck -V - - name: Run ShellCheck - run: shellcheck mkRAMDisk.sh diff --git a/tests/goss_eject.yaml b/tests/goss_eject.yaml new file mode 100644 index 0000000..79bb97c --- /dev/null +++ b/tests/goss_eject.yaml @@ -0,0 +1,4 @@ +file: + /Volumes/RAMDisk: + exists: false + contents: [] diff --git a/tests/goss_mount.yaml b/tests/goss_mount.yaml new file mode 100644 index 0000000..d5207b9 --- /dev/null +++ b/tests/goss_mount.yaml @@ -0,0 +1,176 @@ +file: + /Volumes/RAMDisk: + exists: true + mode: "0775" + filetype: directory + contents: [] + /Volumes/RAMDisk/.Saved Application State: + exists: true + mode: "0777" + filetype: directory + contents: [] + /Volumes/RAMDisk/.XCODEDebug: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Autosave Information: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Chrome: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Finder: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Firefox: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Homebrew: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Metadata: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Microsoft Remote Desktop Beta: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Photos: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Photos_Cache.noindex: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/QuickLook: + exists: true + mode: "0777" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/QuickLook32: + exists: true + mode: "0777" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Safari: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/Safari_CloudKit: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/ansible: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.apple.Automator: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.apple.Photos: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.apple.appstore: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.apple.iLifeMediaBrowser.ILPhotosTranscodeCache: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.apple.iconservices: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.apple.nsurlsessiond: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.apple.safari: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.evernote.Evernote: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/com.overmacs.photosweeperpaddle: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/discord: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/fsCachedData: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/iMazing: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/lsd: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.cache/qlmanage: + exists: true + mode: "0777" + filetype: directory + contents: [] + /Volumes/RAMDisk/.logs: + exists: true + mode: "0777" + filetype: directory + contents: [] + /Volumes/RAMDisk/.tmp: + exists: true + mode: "0755" + filetype: directory + contents: [] + /Volumes/RAMDisk/.tmpdirT: + exists: true + mode: "0777" + filetype: directory + contents: []