Skip to content

Commit

Permalink
Merge pull request #125 from armanbilge/pr/cirrus-ci
Browse files Browse the repository at this point in the history
Setup Cirrus ARM CI
  • Loading branch information
armanbilge authored Jun 6, 2023
2 parents fcba3c1 + cfcc067 commit 1fc7e54
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
native_arm_task:
arm_container:
dockerfile: .cirrus/Dockerfile
cpu: 2
memory: 8G
matrix:
- name: Native ARM 2.12
script: sbt '++ 2.12' testsNative/test
- name: Native ARM 2.13
script: sbt '++ 2.13' testsNative/test
- name: Native ARM 3
script: sbt '++ 3' testsNative/test

native_macos_task:
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
cpu: 2
memory: 8G
matrix:
- name: Native Apple Silicon 2.12
script:
- brew install sbt
- sbt '++ 2.12' testsNative/test
- name: Native Apple Silicon 2.13
script:
- brew install sbt
- sbt '++ 2.13' testsNative/test
- name: Native Apple Silicon 3
script:
- brew install sbt
- sbt '++ 3' testsNative/test
3 changes: 3 additions & 0 deletions .cirrus/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM sbtscala/scala-sbt:eclipse-temurin-jammy-17.0.5_8_1.8.2_3.2.2

RUN apt-get update && apt-get install -y clang
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,8 @@ jobs:
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
- name: Wait for Cirrus CI
uses: typelevel/await-cirrus@main

- name: Publish
run: sbt tlCiRelease
6 changes: 6 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
} yield MatrixExclude(Map("scala" -> scala, "os" -> os))
}

ThisBuild / githubWorkflowPublishPreamble +=
WorkflowStep.Use(
UseRef.Public("typelevel", "await-cirrus", "main"),
name = Some("Wait for Cirrus CI")
)

ThisBuild / githubWorkflowBuild ++= Seq(
WorkflowStep.Sbt(
List("example/run"),
Expand Down
30 changes: 23 additions & 7 deletions core/src/main/scala/epollcat/unsafe/epoll.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package epollcat.unsafe

import scala.scalanative.meta.LinktimeInfo
import scala.scalanative.unsafe._

@extern
Expand Down Expand Up @@ -51,15 +52,30 @@ private[unsafe] object epollImplicits {
def events_=(events: CUnsignedInt): Unit =
!epoll_event.asInstanceOf[Ptr[CUnsignedInt]] = events

def data: epoll_data_t =
!(epoll_event.asInstanceOf[Ptr[Byte]] + sizeof[CUnsignedInt])
.asInstanceOf[Ptr[epoll_data_t]]
def data_=(data: epoll_data_t): Unit =
!(epoll_event.asInstanceOf[Ptr[Byte]] + sizeof[CUnsignedInt])
.asInstanceOf[Ptr[epoll_data_t]] = data
def data: epoll_data_t = {
val offset =
if (LinktimeInfo.target.arch == "x86_64")
sizeof[CUnsignedInt]
else
sizeof[Ptr[Byte]]
!(epoll_event.asInstanceOf[Ptr[Byte]] + offset).asInstanceOf[Ptr[epoll_data_t]]
}

def data_=(data: epoll_data_t): Unit = {
val offset =
if (LinktimeInfo.target.arch == "x86_64")
sizeof[CUnsignedInt]
else
sizeof[Ptr[Byte]]
!(epoll_event.asInstanceOf[Ptr[Byte]] + offset).asInstanceOf[Ptr[epoll_data_t]] = data
}

}

implicit val epoll_eventTag: Tag[epoll_event] =
Tag.materializeCArrayTag[Byte, Nat.Digit2[Nat._1, Nat._2]].asInstanceOf[Tag[epoll_event]]
if (LinktimeInfo.target.arch == "x86_64")
Tag.materializeCArrayTag[Byte, Nat.Digit2[Nat._1, Nat._2]].asInstanceOf[Tag[epoll_event]]
else
Tag.materializeCArrayTag[Byte, Nat.Digit2[Nat._1, Nat._6]].asInstanceOf[Tag[epoll_event]]

}

0 comments on commit 1fc7e54

Please sign in to comment.