Skip to content

Commit

Permalink
Attempt to add macos to ci (#16)
Browse files Browse the repository at this point in the history
* Attempt to add macos

* Update install-nix-action

* Add java entries to .bazelrc

* Configure java to elm-proto example

* Adjust nix expr for macos protoc-gen-elm compatibility

* Fix

* Update sha256

* Check elm-test on macos

* Enable all tests.
  • Loading branch information
kczulko authored Mar 2, 2023
1 parent 67c0368 commit cea8ebc
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
os:
- ubuntu-latest
- macos-11
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -19,7 +21,7 @@ jobs:
with:
path: ~/repo-cache
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=./nixpkgs.nix
- name: Integration tests
Expand Down
2 changes: 2 additions & 0 deletions examples/elm-proto/.bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host
build --java_runtime_version=nixpkgs_java
build --tool_java_runtime_version=nixpkgs_java
24 changes: 17 additions & 7 deletions examples/elm-proto/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,20 @@ nixpkgs_package(
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
osSuffix = if stdenv.isDarwin then "osx" else "linux";
sha256Darwin = "sha256-lD73CVQC6srB2/3bg6J5BiOSWUvN+1V8UZ2Eg1Atn5k=";
sha256Linux = "sha256-0JZ3WCGybG4pVC0JYVnX3KlC9U1R7s0so4l7fLbaaF4=";
checkSum = if stdenv.isDarwin then sha256Darwin else sha256Linux;
in
pkgs.stdenv.mkDerivation {
name = "protoc-gen-elm";
src = fetchurl {
url = "https://github.com/tiziano88/elm-protobuf/releases/download/3.0.0/elm-protobuf-3.0.0-linux-x86_64.tar.gz";
sha256 = "sha256-0JZ3WCGybG4pVC0JYVnX3KlC9U1R7s0so4l7fLbaaF4=";
url = "https://github.com/tiziano88/elm-protobuf/releases/download/3.0.0/elm-protobuf-3.0.0-${osSuffix}-x86_64.tar.gz";
sha256 = checkSum;
};
# nativeBuildInputs = [
# autoPatchelfHook
# ];
sourceRoot = "bin/elm-protobuf-3.0.0-linux-x86_64";
sourceRoot = "bin/elm-protobuf-3.0.0-${osSuffix}-x86_64";
installPhase = ''
install -m755 -D protoc-gen-elm $out/bin/protoc-gen-elm
Expand Down Expand Up @@ -171,3 +173,11 @@ nixpkgs_package(
repository = "@nixpkgs",
)

load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_java_configure")
nixpkgs_java_configure(
attribute_path = "jdk11.home",
repository = "@nixpkgs",
toolchain = True,
toolchain_name = "nixpkgs_java",
toolchain_version = "11",
)
4 changes: 4 additions & 0 deletions examples/elm-test/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host
build --java_runtime_version=nixpkgs_java
build --tool_java_runtime_version=nixpkgs_java

8 changes: 8 additions & 0 deletions examples/elm-test/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,11 @@ elm_repository(
urls = ["https://github.com/elm/time/archive/1.0.0.tar.gz"],
)

load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_java_configure")
nixpkgs_java_configure(
attribute_path = "jdk11.home",
repository = "@nixpkgs",
toolchain = True,
toolchain_name = "nixpkgs_java",
toolchain_version = "11",
)

0 comments on commit cea8ebc

Please sign in to comment.