Skip to content

Commit

Permalink
Merge tag 'v0.22.0' into merge
Browse files Browse the repository at this point in the history
Added
- Added support for using the action in multiple steps in the same job ([cross-platform-actions#26](cross-platform-actions#26)).
    All the inputs need to be the same for all steps, except for the following
    inputs: `sync_files`, `shutdown_vm` and `run`.

- Added support for specifying that the VM should not shutdown after the action
    has run. This adds a new input parameter: `shutdown_vm`. When set to `false`,
    this will hopefully mitigate very frequent freezing of VM during teardown ([cross-platform-actions#61](cross-platform-actions#61), [cross-platform-actions#72](cross-platform-actions#72)).

Changed
- Always terminate VM instead of shutting down. This is more efficient and this
    will hopefully mitigate very frequent freezing of VM during teardown
    ([cross-platform-actions#61](cross-platform-actions#61),
    [cross-platform-actions#72](cross-platform-actions#72)).

- Use `unsafe` as the cache mode for QEMU disks. This should improve performance ([cross-platform-actions#67](cross-platform-actions#67)).
  • Loading branch information
korli committed Mar 15, 2024
2 parents b3366ea + 5800fa0 commit 823498d
Show file tree
Hide file tree
Showing 35 changed files with 1,267 additions and 786 deletions.
120 changes: 109 additions & 11 deletions .github/workflows/ci.yml
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: npm install
- run: npm run all

Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -174,7 +174,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -184,6 +184,7 @@ jobs:
operating_system: freebsd
architecture: x86-64
version: '13.0'
shutdown_vm: false
run: env | sort

test-cpu-count-config:
Expand All @@ -193,7 +194,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -204,19 +205,19 @@ jobs:
architecture: x86-64
version: '13.1'
cpu_count: 8
shutdown_vm: false
run: |
sysctl hw.ncpu
[ `sysctl -n hw.ncpu` = 8 ]
# Does not automatically verify anything. Only for manual verification
test-hypervisor-config:
timeout-minutes: 5
name: Test configuring hypervisor
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -227,16 +228,20 @@ jobs:
architecture: x86-64
version: '13.1'
hypervisor: qemu
shutdown_vm: false
run: sysctl hw.model

- name: Hypervisor should still be running, verify it's QEMU
run: ps aux | grep -v grep | grep -q qemu

test-custom-vm-image:
timeout-minutes: 5
name: Test custom VM image
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -247,6 +252,7 @@ jobs:
architecture: x86-64
version: '7.3'
image_url: https://github.com/cross-platform-actions/test-custom-image-builder/releases/download/v1.0.0/openbsd-7.3-x86-64.qcow2
shutdown_vm: false
run: test -f /foo

test-cpu-features:
Expand All @@ -256,7 +262,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -267,8 +273,57 @@ jobs:
architecture: x86-64
version: '13.2'
hypervisor: qemu
shutdown_vm: false
run: dmesg | grep -i avx2

test-no-vm-shutdown:
timeout-minutes: 5
name: Test not shutting down the VM
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Test
uses: ./
with:
operating_system: freebsd
architecture: x86-64
version: '13.2'
hypervisor: qemu
shutdown_vm: false
run: true

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

test-vm-shutdown:
timeout-minutes: 5
name: Test shutting down the VM
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Test
uses: ./
with:
operating_system: freebsd
architecture: x86-64
version: '13.2'
hypervisor: qemu
shutdown_vm: true
run: true

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

test-sync-files:
timeout-minutes: 5
name: 'Test sync files: ${{ matrix.data.direction }}'
Expand All @@ -295,7 +350,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -308,7 +363,50 @@ jobs:
architecture: x86-64
version: '13.2'
sync_files: ${{ matrix.data.direction }}
shutdown_vm: false
run: ${{ matrix.data.run }}

- 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: test -f foo.txt

- name: Run action second time
uses: ./
with:
operating_system: freebsd
architecture: x86-64
version: '13.2'
hypervisor: qemu
shutdown_vm: true
run: test -f foo.txt
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,46 @@
name: Release

on:
workflow_run:
workflows: [CI]
types: [completed]

jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 2
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Extract changelog
uses: sean0x42/markdown-extract@v2
id: extract_changelog
with:
file: changelog.md
pattern: '\[${{ steps.version.outputs.version }}\].+'
no-print-matched-heading: true

- name: Validate version
id: version
run: |
set -x
tag='${{ github.event.workflow_run.head_branch }}'
if echo "$tag" | grep -Pq '^v\d+\.\d+\.\d+(-.+)?'; then
echo valid=true >> "$GITHUB_OUTPUT"
echo version="$(echo "$tag" | sed 's/^v//')" >> "$GITHUB_OUTPUT"
fi
- name: Create release
if: steps.version.outputs.valid
uses: softprops/action-gh-release@v1
with:
name: Cross Platform Action ${{ steps.version.outputs.version }}
draft: true
body: ${{ steps.extract_changelog.outputs.markdown }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/support/test/action.yml
Expand Up @@ -31,6 +31,7 @@ runs:
operating_system: ${{ inputs.name }}
architecture: ${{ inputs.architecture }}
version: '${{ inputs.version }}'
shutdown_vm: false
run: |
uname -a
echo $SHELL
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Expand Up @@ -49,9 +49,14 @@ inputs:
machine and in which direction. Valid values are `true`, `false`,
`runner-to-vm` and `vm-to-runner`.
default: 'true'
shutdown_vm:
required: false
description: |
Specifies if the VM should be shutdown after the action has been run.
default: true

runs:
using: node16
using: node20
main: dist/index.js

branding:
Expand Down
26 changes: 25 additions & 1 deletion changelog.md
Expand Up @@ -6,6 +6,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.22.0] - 2023-12-27
### Added
- Added support for using the action in multiple steps in the same job ([#26](https://github.com/cross-platform-actions/action/issues/26)).
All the inputs need to be the same for all steps, except for the following
inputs: `sync_files`, `shutdown_vm` and `run`.

- Added support for specifying that the VM should not shutdown after the action
has run. This adds a new input parameter: `shutdown_vm`. When set to `false`,
this will hopefully mitigate very frequent freezing of VM during teardown ([#61](https://github.com/cross-platform-actions/action/issues/61), [#72](https://github.com/cross-platform-actions/action/issues/72)).

### Changed
- Always terminate VM instead of shutting down. This is more efficient and this
will hopefully mitigate very frequent freezing of VM during teardown
([#61](https://github.com/cross-platform-actions/action/issues/61),
[#72](https://github.com/cross-platform-actions/action/issues/72)).

- Use `unsafe` as the cache mode for QEMU disks. This should improve performance ([#67](https://github.com/cross-platform-actions/action/issues/67)).

## [0.21.1] - 2023-11-03
### Fixed
- FreeBSD jobs occasionally fail when ejecting the disk ([#64](https://github.com/cross-platform-actions/action/issues/64))

## [0.21.0] - 2023-10-26
### Added
- Add support for OpenBSD 7.4 ([openbsd-builder#15](https://github.com/cross-platform-actions/openbsd-builder/issues/15))
Expand Down Expand Up @@ -144,8 +166,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release

[Unreleased]: https://github.com/cross-platform-actions/action/compare/v0.21.0...HEAD
[Unreleased]: https://github.com/cross-platform-actions/action/compare/v0.22.0...HEAD

[0.22.0]: https://github.com/cross-platform-actions/action/compare/v0.21.1...v0.22.0
[0.21.1]: https://github.com/cross-platform-actions/action/compare/v0.21.0...v0.21.1
[0.21.0]: https://github.com/cross-platform-actions/action/compare/v0.20.0...v0.21.0
[0.20.0]: https://github.com/cross-platform-actions/action/compare/v0.19.1...v0.20.0
[0.19.1]: https://github.com/cross-platform-actions/action/compare/v0.19.0...v0.19.1
Expand Down

0 comments on commit 823498d

Please sign in to comment.