Repository navigation
93 lines (79 loc) · 2.57 KB
/
Copy pathmulti-repo-build.yml
File metadata and controls
93 lines (79 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Multi-Repo Build
on:
workflow_dispatch:
inputs:
repos:
description: 'Space-separated list of GitHub repos (e.g., "ocaml-dune/notty ocaml/ocaml-re")'
required: true
type: string
depext_linux:
description: 'Space-separated apt packages for Linux (optional)'
required: false
type: string
default: ''
depext_macos:
description: 'Space-separated brew packages for macOS (optional)'
required: false
type: string
default: ''
env:
EXTRA_NIX_CONFIG: |
extra-substituters = https://anmonteiro.nix-cache.workers.dev
extra-trusted-public-keys = ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=
jobs:
build:
name: Build repos with Dune
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Dune
uses: actions/checkout@v6
- name: Set up Nix
uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- name: Cache Nix store
uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-nix-build-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-nix-build-
save: false
- name: Build Dune
run: nix build
- name: Set up workspace directory
run: mkdir workspace
- name: Clone repositories
run: |
cd workspace
for repo in ${{ inputs.repos }}; do
echo "Cloning $repo..."
repo_name=$(echo $repo | sed 's/.*\///')
git clone https://github.com/$repo.git $repo_name
done
- name: Generate dune-workspace
run: |
cd workspace
cat > dune-workspace <<EOF
(lang dune 3.21)
(pkg enabled)
EOF
echo "Generated dune-workspace:"
cat dune-workspace
- name: Install system dependencies (Linux)
if: runner.os == 'Linux' && inputs.depext_linux != ''
run: |
sudo apt-get update
sudo apt-get install -y ${{ inputs.depext_linux }}
- name: Install system dependencies (macOS)
if: runner.os == 'macOS' && inputs.depext_macos != ''
run: |
brew install ${{ inputs.depext_macos }}
- name: Lock dependencies
run: cd workspace && nix run .. -- pkg lock
- name: Build
run: cd workspace && nix run .. -- build