diff --git a/.github/workflows/automerge_to_main.yml b/.github/workflows/automerge_to_main.yml new file mode 100644 index 0000000..ec295ff --- /dev/null +++ b/.github/workflows/automerge_to_main.yml @@ -0,0 +1,20 @@ +name: Create PR to merge release branch into the main branch +# Changes should land on the earliest release branch they will need to ship on and then be automatically forwarded to main +permissions: + contents: read +on: + schedule: + - cron: '0 9 * * *' + workflow_dispatch: +jobs: + create_merge_pr: + name: Create PR to merge release branch into main branch + uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@0.0.15 + with: + base_branch: main + head_branch: release/1.8.x + pr_message: This PR was automatically opened by a GitHub action. Review the changes included in this PR and determine if they should be included on main. If yes, merge the PR. Otherwise revert changes that should not be included on this branch. + permissions: + contents: write + pull-requests: write + if: (github.event_name == 'schedule' && github.repository == 'apple/swift-system') || (github.event_name != 'schedule') # Ensure that we don't run this on a schedule in a fork diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ca6fbea..88c5e25 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -5,7 +5,7 @@ permissions: on: pull_request: - types: [opened, reopened, synchronize] + types: [opened, reopened, synchronize, ready_for_review] jobs: tests: diff --git a/README.md b/README.md index bc8db5a..c4c2ad3 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Changes must land on the branch corresponding to the earliest release that they `release/1.7.0` → `release/1.8.x` → `main` -For example, anything landing on `release/1.6.0` will eventually appear on `release/1.7.0`, then `release/1.8.x` and finally `main` as well. There is no need to file standalone PRs for each release line. (Change propagation currently requires manual work -- it is performed by project maintainers.) +For example, anything landing on `release/1.7.0` will eventually appear on `release/1.8.x` and finally `main` as well. There is no need to file standalone PRs for each release line. (Merges into `main` are performed by the [automerger](.github/workflows/automerge_to_main.yml); propagation between release branches is performed by project maintainers.) ### Code of Conduct diff --git a/Tests/SystemTests/IORequestTests.swift b/Tests/SystemTests/IORequestTests.swift index 2e1c98e..a1f5d41 100644 --- a/Tests/SystemTests/IORequestTests.swift +++ b/Tests/SystemTests/IORequestTests.swift @@ -55,6 +55,25 @@ final class IORequestTests: XCTestCase { } } + func testInferredRebasedWriteBuffer() { + var bytes: [UInt8] = [1, 2, 3]; + bytes.withUnsafeMutableBytes { buffer in + let written = 1 + let file = FileDescriptor(rawValue: 7) + let request = IORing.Request.write( + .init(rebasing: buffer[written...]), into: file, at: UInt64(written) + ).makeRawRequest(pathBuffers: PendingPathBuffers(reservedCapacity: 0)) + let registered = IORing.Request.write( + .init(rebasing: buffer[written...]), + into: IORing.RegisteredFile(resource: 7, index: 3), at: UInt64(written) + ).makeRawRequest(pathBuffers: PendingPathBuffers(reservedCapacity: 0)) + XCTAssertEqual(request.rawValue.len, 2) + XCTAssertEqual(request.rawValue.off, 1) + XCTAssertEqual(registered.rawValue.len, 2) + XCTAssertEqual(registered.rawValue.off, 1) + } + } + func testMutableWriteFunctionReferences() { let write: (UnsafeMutableRawBufferPointer, FileDescriptor, UInt64, UInt64) -> IORing.Request = IORing.Request.write