Skip to content

Commit

Permalink
Merge pull request #188 from tweag/yuriy.taraday/fix-macos-ci
Browse files Browse the repository at this point in the history
macOS CI fixes
  • Loading branch information
mergify[bot] authored Feb 21, 2022
2 parents de066d5 + 5110ff1 commit fe8ca3a
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 28 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-10.15] # TODO: this job does not yet work on more recent macOS (macos-11)
os:
- ubuntu-latest
- macos-11
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
Expand All @@ -32,7 +34,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # TODO: this job does not yet work on any version of macOS
os:
- ubuntu-latest
- macos-11
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
Expand All @@ -49,16 +53,33 @@ jobs:
EOF
- name: Build & test
run: |
skip() {
echo "Will skip $(head -n1 $2/README.md) ${1%_nix} Nix"
local p="$1[@]"
read -a ${1} <<< $(echo ${!p//$2})
}
cd examples/toolchains
for dir in *; do
with_nix=( $(ls) )
without_nix=( cc go rust )
if [ "${{ runner.os }}" == "macOS" ]; then
# Python - https://github.com/tweag/rules_nixpkgs/issues/186
skip with_nix python
# Rust - https://github.com/tweag/rules_nixpkgs/issues/187
skip with_nix rust
skip without_nix rust
fi
for dir in "${with_nix[@]}"; do
cd "$dir"
echo
echo Running $(head -n1 README.md) with Nix
nix-shell --command 'bazel run --config=nix :hello'
# TODO: all toolchains should run without Nixpkgs
cd ..
done
for dir in cc go rust; do
for dir in "${without_nix[@]}"; do
cd "$dir"
echo
echo Running $(head -n1 README.md) without Nix
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ bazel_skylib_workspace()
nixpkgs_git_repository(
name = "remote_nixpkgs",
remote = "https://github.com/NixOS/nixpkgs",
revision = "18.09",
sha256 = "6451af4083485e13daa427f745cbf859bc23cb8b70454c017887c006a13bd65e",
revision = "21.11",
sha256 = "c77bb41cf5dd82f4718fa789d49363f512bb6fa6bc25f8d60902fe2d698ed7cc",
)

nixpkgs_local_repository(
Expand Down
7 changes: 7 additions & 0 deletions examples/toolchains/cc/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/cc/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
# nixpkgs-unstable as of 2021-02-19
spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
nixpkgs = fetchTarball {
url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
sha256 = spec.sha256;
};
in
import nixpkgs
5 changes: 1 addition & 4 deletions examples/toolchains/cc/shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{ pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz";
sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02";
}) { } }:
{ pkgs ? import ./nixpkgs.nix { } }:

pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/cc_with_deps/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/cc_with_deps/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
# nixpkgs-unstable as of 2021-02-19
spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
nixpkgs = fetchTarball {
url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
sha256 = spec.sha256;
};
in
import nixpkgs
5 changes: 1 addition & 4 deletions examples/toolchains/cc_with_deps/shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{ pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz";
sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02";
}) { } }:
{ pkgs ? import ./nixpkgs.nix { } }:

pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/go/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/go/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
# nixpkgs-unstable as of 2021-02-19
spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
nixpkgs = fetchTarball {
url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
sha256 = spec.sha256;
};
in
import nixpkgs
5 changes: 1 addition & 4 deletions examples/toolchains/go/shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{ pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz";
sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02";
}) { } }:
{ pkgs ? import ./nixpkgs.nix { } }:

pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/python/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/python/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
# nixpkgs-unstable as of 2021-02-19
spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
nixpkgs = fetchTarball {
url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
sha256 = spec.sha256;
};
in
import nixpkgs
5 changes: 1 addition & 4 deletions examples/toolchains/python/shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{ pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz";
sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02";
}) { } }:
{ pkgs ? import ./nixpkgs.nix { } }:

pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/rust/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/rust/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
# nixpkgs-unstable as of 2021-02-19
spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
nixpkgs = fetchTarball {
url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
sha256 = spec.sha256;
};
in
import nixpkgs
5 changes: 1 addition & 4 deletions examples/toolchains/rust/shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{ pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz";
sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02";
}) { } }:
{ pkgs ? import ./nixpkgs.nix { } }:

pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; }
4 changes: 2 additions & 2 deletions nixpkgs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "nixpkgs-unstable",
"rev": "ad4db3f4d8ae54482c63c31c14921cb73953548d",
"sha256": "1fwl898f6wznkjpwq11brgadz6iff5w5f4lwj2l7ax2rz7r03mnn"
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}

0 comments on commit fe8ca3a

Please sign in to comment.