Skip to content

Commit

Permalink
fixup! Fix #26: Add support for running the action multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-carlborg committed Dec 7, 2023
1 parent 50fae5a commit c819864
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 49 deletions.
84 changes: 38 additions & 46 deletions .github/workflows/ci.yml
Expand Up @@ -355,52 +355,44 @@ jobs:
# - name: Run after
# run: ${{ matrix.data.run_after }}

# multiple-steps:
# timeout-minutes: 5
# name: Test running the action multiple times
# runs-on: macos-latest
#
# strategy:
# fail-fast: false
# matrix:
# hypervisor: [qemu, xhyve]
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# persist-credentials: false
#
# - name: Run action first time
# uses: ./
# with:
# operating_system: freebsd
# architecture: x86-64
# version: '13.2'
# hypervisor: ${{ matrix.hypervisor }}
# shutdown_vm: false
# run: touch foo.txt
#
# - name: Verify VM is still running
# run: ps aux | grep -v grep | grep -q -v qemu
#
# - name: Verify file is synced back
# run: ps aux | grep -v grep | grep -q -v qemu
#
# - name: Run action second time
# uses: ./
# with:
# operating_system: freebsd
# architecture: x86-64
# version: '13.2'
# hypervisor: qemu
# shutdown_vm: false
# run: test -f foo.txt

foo:
multiple-steps:
timeout-minutes: 5
name: Test running the action multiple times
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
hypervisor: [qemu, xhyve]

steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Run action first time
uses: ./
with:
operating_system: freebsd
architecture: x86-64
version: '13.2'
hypervisor: ${{ matrix.hypervisor }}
shutdown_vm: false
run: touch foo.txt

- name: Verify VM is still running
run: ps aux | grep -v grep | grep -q -v qemu

- name: Verify file is synced back
run: ps aux | grep -v grep | grep -q -v qemu

- name: Run action second time
uses: ./
with:
limit-access-to-actor: true
operating_system: freebsd
architecture: x86-64
version: '13.2'
hypervisor: qemu
shutdown_vm: false
run: test -f foo.txt
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/action/action.ts
Expand Up @@ -570,6 +570,8 @@ class QemuSshConfiguration extends SshConfigurator {
private setupHostname(ipAddress: string): void {
if (ipAddress === 'localhost') ipAddress = '127.0.0.1'

execSync(`sudo printf '${ipAddress} ${this.cpaHost}\n' >> /etc/hosts`)
execSync(
`sudo bash -c 'printf "${ipAddress} ${this.cpaHost}\n" >> /etc/hosts'`
)
}
}

0 comments on commit c819864

Please sign in to comment.