From 50c33fbfaaf0b530ffe507c742efc405c2e74ebe Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 05:54:26 +0900 Subject: [PATCH 01/26] poc: cache opam actions --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 469b8660b8..3246dea615 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -213,9 +213,16 @@ jobs: chmod +x rewatch/rewatch chmod +x _build/install/default/bin/* + - name: Restore OPAM env + id: cache-opam-env + uses: actions/cache/restore@v4 + with: + path: ~/.opam + key: opam-env-${{ runner.os }}-${{ hashFiles('dune-project') }} + - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 - if: matrix.os != 'windows-latest' + if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' with: ocaml-compiler: ${{matrix.ocaml_compiler}} opam-pin: false @@ -223,7 +230,7 @@ jobs: - name: Use OCaml ${{matrix.ocaml_compiler}} (Win) uses: ocaml/setup-ocaml@v2 - if: matrix.os == 'windows-latest' + if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' with: ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw opam-pin: false @@ -234,8 +241,46 @@ jobs: default: https://github.com/ocaml/opam-repository.git - name: "Install OPAM dependencies" + if: steps.cache-opam-env.outputs.cache-hit != 'true' run: opam install . --deps-only + - name: Cache OPAM env + if: steps.cache-opam-env.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: ~/.opam + key: opam-env-${{ runner.os }}-${{ hashFiles('dune-project') }} + + - name: Get OPAM path + if: steps.cache-opam-env.outputs.cache-hit != 'true' + run: | + which opam > .opam-path + + - name: Cache OPAM path + id: cache-opam-path + if: steps.cache-opam-env.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: .opam-path + key: opam-path-${{ runner.os }} + + - name: Restore OPAM path + if: steps.cache-opam-env.outputs.cache-hit == 'true' + uses: actions/cache/restore@v4 + with: + path: .opam-path + key: opam-path-${{ runner.os }} + + - name: Use cached OPAM env + if: steps.cache-opam-env.outputs.cache-hit == 'true' + run: | + cat .opam-path >> $GITHUB_PATH + + - name: Use cached OPAM env + if: steps.cache-opam-env.outputs.cache-hit == 'true' + run: | + opam env | sed "s/'//g; s/; export .*//g" >> $GITHUB_ENV + - name: "Build compiler" if: runner.os != 'Linux' run: opam exec -- dune build --display quiet --profile release From 682bb8ee1d99fe480840b51fe36dbebff742d016 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 06:04:05 +0900 Subject: [PATCH 02/26] it should be a dirname --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3246dea615..e429cb0179 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -274,7 +274,7 @@ jobs: - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | - cat .opam-path >> $GITHUB_PATH + dirname $(cat .opam-path) >> $GITHUB_PATH - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' From b6eb9ddf8f434b387718725a94dd1f347ab6ef76 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 06:14:45 +0900 Subject: [PATCH 03/26] debug opam-path --- .github/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e429cb0179..81c48c4b5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -222,7 +222,8 @@ jobs: - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 - if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' + # if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' + if: matrix.os != 'windows-latest' with: ocaml-compiler: ${{matrix.ocaml_compiler}} opam-pin: false @@ -230,7 +231,8 @@ jobs: - name: Use OCaml ${{matrix.ocaml_compiler}} (Win) uses: ocaml/setup-ocaml@v2 - if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' + # if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' + if: matrix.os == 'windows-latest' with: ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw opam-pin: false @@ -241,7 +243,7 @@ jobs: default: https://github.com/ocaml/opam-repository.git - name: "Install OPAM dependencies" - if: steps.cache-opam-env.outputs.cache-hit != 'true' + # if: steps.cache-opam-env.outputs.cache-hit != 'true' run: opam install . --deps-only - name: Cache OPAM env @@ -252,8 +254,9 @@ jobs: key: opam-env-${{ runner.os }}-${{ hashFiles('dune-project') }} - name: Get OPAM path - if: steps.cache-opam-env.outputs.cache-hit != 'true' + # if: steps.cache-opam-env.outputs.cache-hit != 'true' run: | + which opam which opam > .opam-path - name: Cache OPAM path @@ -274,6 +277,9 @@ jobs: - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | + cat .opam-path + dirname $(cat .opam-path) + ls $(dirname $(cat .opam-path)) dirname $(cat .opam-path) >> $GITHUB_PATH - name: Use cached OPAM env From 53d59db1259a7e8d5161f0403bbe3f5925028129 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 06:35:28 +0900 Subject: [PATCH 04/26] then work? --- .github/workflows/ci.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81c48c4b5b..12f7040152 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -222,8 +222,7 @@ jobs: - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 - # if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' - if: matrix.os != 'windows-latest' + if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' with: ocaml-compiler: ${{matrix.ocaml_compiler}} opam-pin: false @@ -231,8 +230,7 @@ jobs: - name: Use OCaml ${{matrix.ocaml_compiler}} (Win) uses: ocaml/setup-ocaml@v2 - # if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' - if: matrix.os == 'windows-latest' + if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' with: ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw opam-pin: false @@ -242,8 +240,8 @@ jobs: sunset: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset default: https://github.com/ocaml/opam-repository.git - - name: "Install OPAM dependencies" - # if: steps.cache-opam-env.outputs.cache-hit != 'true' + - name: Install OPAM dependencies + if: steps.cache-opam-env.outputs.cache-hit != 'true' run: opam install . --deps-only - name: Cache OPAM env @@ -254,7 +252,7 @@ jobs: key: opam-env-${{ runner.os }}-${{ hashFiles('dune-project') }} - name: Get OPAM path - # if: steps.cache-opam-env.outputs.cache-hit != 'true' + if: steps.cache-opam-env.outputs.cache-hit != 'true' run: | which opam which opam > .opam-path @@ -277,10 +275,8 @@ jobs: - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | - cat .opam-path - dirname $(cat .opam-path) - ls $(dirname $(cat .opam-path)) - dirname $(cat .opam-path) >> $GITHUB_PATH + chmod +x "$(cat .opam-path)" + dirname "$(cat .opam-path)" >> $GITHUB_PATH - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' From ebc9ef088230f134898e675366b583fdba7a109e Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 07:01:07 +0900 Subject: [PATCH 05/26] why --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12f7040152..2eb2cf375f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -275,8 +275,10 @@ jobs: - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | + ls -al "$(dirname "$(cat .opam-path)")" + ls -al "$(cat .opam-path)" chmod +x "$(cat .opam-path)" - dirname "$(cat .opam-path)" >> $GITHUB_PATH + echo "$(dirname "$(cat .opam-path)")" >> $GITHUB_PATH - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' From 6deafb42266b61c22e14e81320f942e80af95c77 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 07:31:42 +0900 Subject: [PATCH 06/26] should work --- .github/workflows/ci.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2eb2cf375f..e9e8192d6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,8 +217,10 @@ jobs: id: cache-opam-env uses: actions/cache/restore@v4 with: - path: ~/.opam - key: opam-env-${{ runner.os }}-${{ hashFiles('dune-project') }} + path: | + ${{ runner.tool_cache }}/opam + ~/.opam + key: opam-env-v1-${{ runner.os }}-${{ hashFiles('dune-project') }} - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 @@ -248,8 +250,10 @@ jobs: if: steps.cache-opam-env.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - path: ~/.opam - key: opam-env-${{ runner.os }}-${{ hashFiles('dune-project') }} + path: | + ${{ runner.tool_cache }}/opam + ~/.opam + key: opam-env-v1-${{ runner.os }}-${{ hashFiles('dune-project') }} - name: Get OPAM path if: steps.cache-opam-env.outputs.cache-hit != 'true' @@ -275,10 +279,9 @@ jobs: - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | - ls -al "$(dirname "$(cat .opam-path)")" - ls -al "$(cat .opam-path)" - chmod +x "$(cat .opam-path)" - echo "$(dirname "$(cat .opam-path)")" >> $GITHUB_PATH + OPAM_PATH="$(cat .opam-path)" + chmod +x $OPAM_PATH + dirname $OPAM_PATH >> $GITHUB_PATH - name: Use cached OPAM env if: steps.cache-opam-env.outputs.cache-hit == 'true' From c79d3032e32b7ed4b4bdaae9a7e7f8ab9566f785 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 08:09:47 +0900 Subject: [PATCH 07/26] almost there? --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9e8192d6e..24aa704467 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -213,18 +213,18 @@ jobs: chmod +x rewatch/rewatch chmod +x _build/install/default/bin/* - - name: Restore OPAM env - id: cache-opam-env + - name: Restore OPAM tool + id: cache-opam-tool uses: actions/cache/restore@v4 with: path: | ${{ runner.tool_cache }}/opam ~/.opam - key: opam-env-v1-${{ runner.os }}-${{ hashFiles('dune-project') }} + key: opam-tool-v1-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 - if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' + if: steps.cache-opam-tool.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' with: ocaml-compiler: ${{matrix.ocaml_compiler}} opam-pin: false @@ -232,7 +232,7 @@ jobs: - name: Use OCaml ${{matrix.ocaml_compiler}} (Win) uses: ocaml/setup-ocaml@v2 - if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' + if: steps.cache-opam-tool.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' with: ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw opam-pin: false @@ -243,50 +243,55 @@ jobs: default: https://github.com/ocaml/opam-repository.git - name: Install OPAM dependencies - if: steps.cache-opam-env.outputs.cache-hit != 'true' + if: steps.cache-opam-tool.outputs.cache-hit != 'true' run: opam install . --deps-only - - name: Cache OPAM env - if: steps.cache-opam-env.outputs.cache-hit != 'true' + - name: Save OPAM tool + if: steps.cache-opam-tool.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: path: | ${{ runner.tool_cache }}/opam ~/.opam - key: opam-env-v1-${{ runner.os }}-${{ hashFiles('dune-project') }} + key: opam-tool-v1-${{ matrix.os }}-${{ hashFiles('dune-project') }} - - name: Get OPAM path - if: steps.cache-opam-env.outputs.cache-hit != 'true' + - name: Get OPAM env + if: steps.cache-opam-tool.outputs.cache-hit != 'true' run: | - which opam which opam > .opam-path + opam env > .opam-env - - name: Cache OPAM path - id: cache-opam-path - if: steps.cache-opam-env.outputs.cache-hit != 'true' + - name: Save OPAM env + id: cache-opam-env + if: steps.cache-opam-tool.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - path: .opam-path - key: opam-path-${{ runner.os }} + path: | + .opam-path + .opam-env + key: opam-path-${{ matrix.os }} - - name: Restore OPAM path - if: steps.cache-opam-env.outputs.cache-hit == 'true' + - name: Restore OPAM env + if: steps.cache-opam-tool.outputs.cache-hit == 'true' uses: actions/cache/restore@v4 with: - path: .opam-path - key: opam-path-${{ runner.os }} + path: | + .opam-path + .opam-env + key: opam-path-${{ matrix.os }} - - name: Use cached OPAM env - if: steps.cache-opam-env.outputs.cache-hit == 'true' + - name: Use cached OPAM env - $PATH + if: steps.cache-opam-tool.outputs.cache-hit == 'true' run: | OPAM_PATH="$(cat .opam-path)" - chmod +x $OPAM_PATH - dirname $OPAM_PATH >> $GITHUB_PATH + chmod +x "$OPAM_PATH" + dirname "$OPAM_PATH" >> "$GITHUB_PATH" - - name: Use cached OPAM env - if: steps.cache-opam-env.outputs.cache-hit == 'true' + - name: Use cached OPAM env - Environment variables + if: steps.cache-opam-tool.outputs.cache-hit == 'true' run: | - opam env | sed "s/'//g; s/; export .*//g" >> $GITHUB_ENV + OPAM_ENV="$(cat .opam-env)" + sed "s/'//g; s/; export .*//g" "$OPAM_ENV" >> "$GITHUB_ENV" - name: "Build compiler" if: runner.os != 'Linux' From e633cb5f5049caa61754f20963e4148e6c698c8c Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 08:30:44 +0900 Subject: [PATCH 08/26] let me just sleep please --- .github/workflows/ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24aa704467..8300e5a9bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -220,7 +220,8 @@ jobs: path: | ${{ runner.tool_cache }}/opam ~/.opam - key: opam-tool-v1-${{ matrix.os }}-${{ hashFiles('dune-project') }} + _opam + key: opam-tool-v2-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 @@ -253,7 +254,8 @@ jobs: path: | ${{ runner.tool_cache }}/opam ~/.opam - key: opam-tool-v1-${{ matrix.os }}-${{ hashFiles('dune-project') }} + _opam + key: opam-tool-v2-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Get OPAM env if: steps.cache-opam-tool.outputs.cache-hit != 'true' @@ -269,7 +271,7 @@ jobs: path: | .opam-path .opam-env - key: opam-path-${{ matrix.os }} + key: opam-env-v1-${{ matrix.os }} - name: Restore OPAM env if: steps.cache-opam-tool.outputs.cache-hit == 'true' @@ -278,7 +280,7 @@ jobs: path: | .opam-path .opam-env - key: opam-path-${{ matrix.os }} + key: opam-env-v1-${{ matrix.os }} - name: Use cached OPAM env - $PATH if: steps.cache-opam-tool.outputs.cache-hit == 'true' @@ -290,8 +292,7 @@ jobs: - name: Use cached OPAM env - Environment variables if: steps.cache-opam-tool.outputs.cache-hit == 'true' run: | - OPAM_ENV="$(cat .opam-env)" - sed "s/'//g; s/; export .*//g" "$OPAM_ENV" >> "$GITHUB_ENV" + sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV" - name: "Build compiler" if: runner.os != 'Linux' From f6bcea79ea6c8a372b857f7d199023d61f5423a2 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 09:22:39 +0900 Subject: [PATCH 09/26] linux system dependencies --- .github/workflows/ci.yml | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8300e5a9bb..f6bae21012 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,9 +54,20 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Restore APT state cache + if: runner.os == 'Linux' + uses: actions/cache/restore@v4 + with: + path: | + /var/lib/apt/lists + /var/cache/apt + key: apt-dependencies-v1 + - name: Install musl gcc if: runner.os == 'Linux' - run: sudo apt-get install -y musl-tools + run: | + sudo apt-get install -y --no-install-recommends \ + musl-tools - name: Set up sccache uses: mozilla-actions/sccache-action@v0.0.4 @@ -213,6 +224,28 @@ jobs: chmod +x rewatch/rewatch chmod +x _build/install/default/bin/* + - name: Cache APT state + if: runner.os == 'Linux' + uses: actions/cache@v4 + with: + path: | + /var/lib/apt/lists + /var/cache/apt + key: apt-dependencies-v1 + + - name: Install dependencies + if: runner.os == 'Linux' + run: | + # See https://github.com/ocaml/setup-ocaml/blob/92dde8cf/packages/setup-ocaml/src/unix.ts#L13 + sudo apt-get install -y --no-install-recommends \ + bubblewrap \ + darcs \ + g++-multilib \ + gcc-multilib \ + mercurial \ + musl-tools \ + rsync + - name: Restore OPAM tool id: cache-opam-tool uses: actions/cache/restore@v4 From 15d60eb44f92aba78f3cb7a5b6aa4fdd4dd32cdb Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 09:35:56 +0900 Subject: [PATCH 10/26] caches --- .github/workflows/ci.yml | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6bae21012..fd21d3d2af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,20 +54,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Restore APT state cache - if: runner.os == 'Linux' - uses: actions/cache/restore@v4 - with: - path: | - /var/lib/apt/lists - /var/cache/apt - key: apt-dependencies-v1 - - name: Install musl gcc if: runner.os == 'Linux' - run: | - sudo apt-get install -y --no-install-recommends \ - musl-tools + run: sudo apt-get install -y --no-install-recommends musl-tools - name: Set up sccache uses: mozilla-actions/sccache-action@v0.0.4 @@ -224,27 +213,13 @@ jobs: chmod +x rewatch/rewatch chmod +x _build/install/default/bin/* - - name: Cache APT state - if: runner.os == 'Linux' - uses: actions/cache@v4 - with: - path: | - /var/lib/apt/lists - /var/cache/apt - key: apt-dependencies-v1 - - name: Install dependencies if: runner.os == 'Linux' - run: | + uses: awalsh128/cache-apt-pkgs-action@v1.4.2 + with: # See https://github.com/ocaml/setup-ocaml/blob/92dde8cf/packages/setup-ocaml/src/unix.ts#L13 - sudo apt-get install -y --no-install-recommends \ - bubblewrap \ - darcs \ - g++-multilib \ - gcc-multilib \ - mercurial \ - musl-tools \ - rsync + packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync + version: v1 - name: Restore OPAM tool id: cache-opam-tool @@ -395,10 +370,6 @@ jobs: run: node scripts/ciTest.js -mocha -theme -format # Build the playground compiler on the fastest runner (ubuntu-latest) - - name: Install JSOO - if: matrix.os == 'ubuntu-latest' - run: opam install js_of_ocaml.5.8.1 - - name: Build playground compiler if: matrix.os == 'ubuntu-latest' run: | From 236c7bee7498fde970fdcea4f9cee2b64e8f1412 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 09:49:12 +0900 Subject: [PATCH 11/26] install jsoo with cache --- dune-project | 2 ++ rescript.opam | 1 + 2 files changed, 3 insertions(+) diff --git a/dune-project b/dune-project index 40275f2713..c0330e42cf 100644 --- a/dune-project +++ b/dune-project @@ -24,6 +24,8 @@ (= 0.26.2)) (cppo (= 1.6.9)) + (js_of_ocaml + (= 5.8.1)) (js_of_ocaml-compiler (= 5.8.1)) (ounit2 diff --git a/rescript.opam b/rescript.opam index 9f65797b65..8448d996b3 100644 --- a/rescript.opam +++ b/rescript.opam @@ -10,6 +10,7 @@ depends: [ "ocaml" {>= "4.10"} "ocamlformat" {= "0.26.2"} "cppo" {= "1.6.9"} + "js_of_ocaml" {= "5.8.1"} "js_of_ocaml-compiler" {= "5.8.1"} "ounit2" {= "2.2.7"} "reanalyze" {= "2.25.1"} From 09d5cf3e7cafe9477f769604b18346645f19fd6d Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 09:50:07 +0900 Subject: [PATCH 12/26] cache rewatch build too --- .github/workflows/ci.yml | 16 ++++++++++++++-- .github/workflows/get_artifact_dir_name.js | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd21d3d2af..38192c4b69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,31 +54,42 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Restore build cache + id: build-cache + uses: actions/cache@v4 + with: + path: rewatch/target + key: rewatch-build-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }} + - name: Install musl gcc - if: runner.os == 'Linux' + if: steps.build-cache.outputs.cache-hit != 'true' && runner.os == 'Linux' run: sudo apt-get install -y --no-install-recommends musl-tools - name: Set up sccache + if: steps.build-cache.outputs.cache-hit != 'true' uses: mozilla-actions/sccache-action@v0.0.4 with: version: "v0.8.0" - name: Install rust toolchain + if: steps.build-cache.outputs.cache-hit != 'true' uses: dtolnay/rust-toolchain@master with: toolchain: stable targets: ${{matrix.rust-target}} - name: Build rewatch + if: steps.build-cache.outputs.cache-hit != 'true' run: cargo build --manifest-path rewatch/Cargo.toml --target ${{matrix.rust-target}} --release - name: Get artifact dir name + id: artifact-dir run: node .github/workflows/get_artifact_dir_name.js - name: "Upload artifact: rewatch binary" uses: actions/upload-artifact@v4 with: - name: rewatch-${{env.artifact_dir_name}} + name: rewatch-${{ steps.artifact-dir.outputs.dirname }} path: rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} # Build statically linked Linux binaries in an Alpine-based Docker container @@ -373,6 +384,7 @@ jobs: - name: Build playground compiler if: matrix.os == 'ubuntu-latest' run: | + opam install js_of_ocaml.5.8.1 opam exec -- node packages/playground-bundling/scripts/generate_cmijs.js opam exec -- dune build --profile browser cp ./_build/default/jscomp/jsoo/jsoo_playground_main.bc.js playground/compiler.js diff --git a/.github/workflows/get_artifact_dir_name.js b/.github/workflows/get_artifact_dir_name.js index 28e245bb5c..1089ea84ca 100644 --- a/.github/workflows/get_artifact_dir_name.js +++ b/.github/workflows/get_artifact_dir_name.js @@ -5,6 +5,6 @@ const { dirName: artifactDirName } = require("../../cli/bin_path.js"); // Pass artifactDirName to subsequent GitHub actions fs.appendFileSync( - process.env.GITHUB_ENV, - `artifact_dir_name=${artifactDirName}${os.EOL}`, + process.env.GITHUB_OUTPUT, + `dirname=${artifactDirName}${os.EOL}`, ); From 73130b954ee38ff0a521a9c5e1d042845b3fa5b2 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 09:59:01 +0900 Subject: [PATCH 13/26] revert some --- .github/workflows/ci.yml | 4 +--- .github/workflows/get_artifact_dir_name.js | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38192c4b69..833dbec082 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,13 +83,12 @@ jobs: run: cargo build --manifest-path rewatch/Cargo.toml --target ${{matrix.rust-target}} --release - name: Get artifact dir name - id: artifact-dir run: node .github/workflows/get_artifact_dir_name.js - name: "Upload artifact: rewatch binary" uses: actions/upload-artifact@v4 with: - name: rewatch-${{ steps.artifact-dir.outputs.dirname }} + name: rewatch-${{env.artifact_dir_name}} path: rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} # Build statically linked Linux binaries in an Alpine-based Docker container @@ -384,7 +383,6 @@ jobs: - name: Build playground compiler if: matrix.os == 'ubuntu-latest' run: | - opam install js_of_ocaml.5.8.1 opam exec -- node packages/playground-bundling/scripts/generate_cmijs.js opam exec -- dune build --profile browser cp ./_build/default/jscomp/jsoo/jsoo_playground_main.bc.js playground/compiler.js diff --git a/.github/workflows/get_artifact_dir_name.js b/.github/workflows/get_artifact_dir_name.js index 1089ea84ca..28e245bb5c 100644 --- a/.github/workflows/get_artifact_dir_name.js +++ b/.github/workflows/get_artifact_dir_name.js @@ -5,6 +5,6 @@ const { dirName: artifactDirName } = require("../../cli/bin_path.js"); // Pass artifactDirName to subsequent GitHub actions fs.appendFileSync( - process.env.GITHUB_OUTPUT, - `dirname=${artifactDirName}${os.EOL}`, + process.env.GITHUB_ENV, + `artifact_dir_name=${artifactDirName}${os.EOL}`, ); From 2c2404d667e6f07e0cdaf9867e6689957ede2304 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 16:02:46 +0900 Subject: [PATCH 14/26] dedupe deps declaration, this should make new cacahe --- dune-project | 2 -- rescript.opam | 1 - 2 files changed, 3 deletions(-) diff --git a/dune-project b/dune-project index c0330e42cf..35aec69994 100644 --- a/dune-project +++ b/dune-project @@ -26,8 +26,6 @@ (= 1.6.9)) (js_of_ocaml (= 5.8.1)) - (js_of_ocaml-compiler - (= 5.8.1)) (ounit2 (= 2.2.7)) (reanalyze diff --git a/rescript.opam b/rescript.opam index 8448d996b3..a436a9f2df 100644 --- a/rescript.opam +++ b/rescript.opam @@ -11,7 +11,6 @@ depends: [ "ocamlformat" {= "0.26.2"} "cppo" {= "1.6.9"} "js_of_ocaml" {= "5.8.1"} - "js_of_ocaml-compiler" {= "5.8.1"} "ounit2" {= "2.2.7"} "reanalyze" {= "2.25.1"} "dune" From 8fffff7966e0e7f052ba19b60176a0eba01a1bef Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 16:05:07 +0900 Subject: [PATCH 15/26] use bash instead of powershell --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 833dbec082..7bc45f610c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,6 +280,7 @@ jobs: run: | which opam > .opam-path opam env > .opam-env + shell: bash - name: Save OPAM env id: cache-opam-env @@ -306,11 +307,13 @@ jobs: OPAM_PATH="$(cat .opam-path)" chmod +x "$OPAM_PATH" dirname "$OPAM_PATH" >> "$GITHUB_PATH" + shell: bash - name: Use cached OPAM env - Environment variables if: steps.cache-opam-tool.outputs.cache-hit == 'true' run: | sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV" + shell: bash - name: "Build compiler" if: runner.os != 'Linux' From 94b01c155906d99b370653588e93307ac2557cad Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 16:31:04 +0900 Subject: [PATCH 16/26] fix Windows --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bc45f610c..6a76cf0a1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -278,7 +278,11 @@ jobs: - name: Get OPAM env if: steps.cache-opam-tool.outputs.cache-hit != 'true' run: | - which opam > .opam-path + if [[ "$RUNNER_OS" == "Windows" ]]; then + which opam.exe > .opam-path + else + which opam > .opam-path + fi opam env > .opam-env shell: bash From 71a73eb78bf55b2a81be36473e5da99fb67b7b47 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 16:46:35 +0900 Subject: [PATCH 17/26] invalidate env cache --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a76cf0a1e..8441dd4db5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -294,7 +294,7 @@ jobs: path: | .opam-path .opam-env - key: opam-env-v1-${{ matrix.os }} + key: opam-env-v2-${{ matrix.os }} - name: Restore OPAM env if: steps.cache-opam-tool.outputs.cache-hit == 'true' @@ -303,7 +303,7 @@ jobs: path: | .opam-path .opam-env - key: opam-env-v1-${{ matrix.os }} + key: opam-env-v2-${{ matrix.os }} - name: Use cached OPAM env - $PATH if: steps.cache-opam-tool.outputs.cache-hit == 'true' From 92dd71f1736afc5dfe614066a46c14543c2caacd Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 16:55:50 +0900 Subject: [PATCH 18/26] fix cache lifecycle --- .github/workflows/ci.yml | 64 ++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8441dd4db5..0107f766ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -231,19 +231,21 @@ jobs: packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync version: v1 - - name: Restore OPAM tool - id: cache-opam-tool + - name: Restore OPAM environment + id: cache-opam-env uses: actions/cache/restore@v4 with: path: | ${{ runner.tool_cache }}/opam ~/.opam _opam - key: opam-tool-v2-${{ matrix.os }}-${{ hashFiles('dune-project') }} + .opam-path + .opam-env + key: opam-env-v3-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 - if: steps.cache-opam-tool.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' + if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest' with: ocaml-compiler: ${{matrix.ocaml_compiler}} opam-pin: false @@ -251,7 +253,7 @@ jobs: - name: Use OCaml ${{matrix.ocaml_compiler}} (Win) uses: ocaml/setup-ocaml@v2 - if: steps.cache-opam-tool.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' + if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' with: ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw opam-pin: false @@ -261,22 +263,8 @@ jobs: sunset: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset default: https://github.com/ocaml/opam-repository.git - - name: Install OPAM dependencies - if: steps.cache-opam-tool.outputs.cache-hit != 'true' - run: opam install . --deps-only - - - name: Save OPAM tool - if: steps.cache-opam-tool.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: | - ${{ runner.tool_cache }}/opam - ~/.opam - _opam - key: opam-tool-v2-${{ matrix.os }}-${{ hashFiles('dune-project') }} - - - name: Get OPAM env - if: steps.cache-opam-tool.outputs.cache-hit != 'true' + - name: Get OPAM environment + if: steps.cache-opam-env.outputs.cache-hit != 'true' run: | if [[ "$RUNNER_OS" == "Windows" ]]; then which opam.exe > .opam-path @@ -286,40 +274,32 @@ jobs: opam env > .opam-env shell: bash - - name: Save OPAM env - id: cache-opam-env - if: steps.cache-opam-tool.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: | - .opam-path - .opam-env - key: opam-env-v2-${{ matrix.os }} + - name: Install OPAM dependencies + if: steps.cache-opam-env.outputs.cache-hit != 'true' + run: opam install . --deps-only - - name: Restore OPAM env - if: steps.cache-opam-tool.outputs.cache-hit == 'true' - uses: actions/cache/restore@v4 + - name: Cache OPAM environment + if: steps.cache-opam-env.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 with: path: | + ${{ runner.tool_cache }}/opam + ~/.opam + _opam .opam-path .opam-env - key: opam-env-v2-${{ matrix.os }} + key: opam-env-v3-${{ matrix.os }}-${{ hashFiles('dune-project') }} - - name: Use cached OPAM env - $PATH - if: steps.cache-opam-tool.outputs.cache-hit == 'true' + - name: Use cached OPAM environment + if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | OPAM_PATH="$(cat .opam-path)" chmod +x "$OPAM_PATH" dirname "$OPAM_PATH" >> "$GITHUB_PATH" - shell: bash - - - name: Use cached OPAM env - Environment variables - if: steps.cache-opam-tool.outputs.cache-hit == 'true' - run: | sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV" shell: bash - - name: "Build compiler" + - name: Build compiler if: runner.os != 'Linux' run: opam exec -- dune build --display quiet --profile release From 14ae1942ff10c360186e99e8447268ba0a0a24a0 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 17:10:42 +0900 Subject: [PATCH 19/26] fix windows --- .github/workflows/ci.yml | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0107f766ca..37da20ab89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -238,10 +238,11 @@ jobs: path: | ${{ runner.tool_cache }}/opam ~/.opam + ~/cygwin _opam .opam-path .opam-env - key: opam-env-v3-${{ matrix.os }}-${{ hashFiles('dune-project') }} + key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 @@ -266,13 +267,8 @@ jobs: - name: Get OPAM environment if: steps.cache-opam-env.outputs.cache-hit != 'true' run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - which opam.exe > .opam-path - else - which opam > .opam-path - fi + command -v opam | tee .opam-path opam env > .opam-env - shell: bash - name: Install OPAM dependencies if: steps.cache-opam-env.outputs.cache-hit != 'true' @@ -285,17 +281,35 @@ jobs: path: | ${{ runner.tool_cache }}/opam ~/.opam + ~/cygwin _opam .opam-path .opam-env - key: opam-env-v3-${{ matrix.os }}-${{ hashFiles('dune-project') }} + key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Use cached OPAM environment if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | - OPAM_PATH="$(cat .opam-path)" - chmod +x "$OPAM_PATH" - dirname "$OPAM_PATH" >> "$GITHUB_PATH" + if [[ "$RUNNER_OS" != "Windows" ]]; then + OPAM_PATH="$(cat .opam-path)" + chmod +x "$OPAM_PATH" + dirname "$OPAM_PATH" >> "$GITHUB_PATH" + + else + CYGWIN="winsymlinks:native" + CYGWIN_ROOT="D:\\cygwin" + CYGWIN_ROOT_BIN="D:\\cygwin\\bin" + CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin" + + echo "CYGWIN=$CYGWIN" >> "$GITHUB_ENV" + echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV" + echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV" + echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV" + + echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH" + echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH" + fi + sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV" shell: bash From ca20214026858f88a83b554cf711f65a956cd417 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Sun, 30 Jun 2024 21:23:00 +0900 Subject: [PATCH 20/26] fix windows cache --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++--------- ninja/misc/ci.py | 2 +- ninja/misc/output_test.py | 2 +- scripts/buildNinjaBinary.js | 2 +- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37da20ab89..db909b6c50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,6 +108,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup Python for ninja build + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Build compiler binaries uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 with: @@ -116,7 +121,7 @@ jobs: - name: Build ninja binary uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 with: - args: sh -c "cd ninja && LDFLAGS=-static python3 configure.py --bootstrap" + args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap" - name: "Upload artifacts" uses: actions/upload-artifact@v4 @@ -223,14 +228,19 @@ jobs: chmod +x rewatch/rewatch chmod +x _build/install/default/bin/* - - name: Install dependencies + - name: Install dependencies (Linux) if: runner.os == 'Linux' uses: awalsh128/cache-apt-pkgs-action@v1.4.2 with: - # See https://github.com/ocaml/setup-ocaml/blob/92dde8cf/packages/setup-ocaml/src/unix.ts#L13 + # See https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/unix.ts#L9 packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync version: v1 + - name: Setup Python for ninja build + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Restore OPAM environment id: cache-opam-env uses: actions/cache/restore@v4 @@ -238,11 +248,12 @@ jobs: path: | ${{ runner.tool_cache }}/opam ~/.opam - ~/cygwin _opam .opam-path .opam-env - key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }} + D:\cygwin + D:\.opam + key: opam-env-v8-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Use OCaml ${{matrix.ocaml_compiler}} uses: ocaml/setup-ocaml@v2 @@ -252,7 +263,7 @@ jobs: opam-pin: false opam-depext: false - - name: Use OCaml ${{matrix.ocaml_compiler}} (Win) + - name: Use OCaml ${{matrix.ocaml_compiler}} (Windows) uses: ocaml/setup-ocaml@v2 if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' with: @@ -281,36 +292,54 @@ jobs: path: | ${{ runner.tool_cache }}/opam ~/.opam - ~/cygwin _opam .opam-path .opam-env - key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }} + D:\cygwin + D:\.opam + key: opam-env-v8-${{ matrix.os }}-${{ hashFiles('dune-project') }} - name: Use cached OPAM environment if: steps.cache-opam-env.outputs.cache-hit == 'true' run: | + # https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/installer.ts#L33 + echo "OPAMVERBOSE=$RUNNER_DEBUG" >> "$GITHUB_ENV" + echo "OPAMCOLOR=always" >> "$GITHUB_ENV" + echo "OPAMCONFIRMLEVEL=unsafe-yes" >> "$GITHUB_ENV" + echo "OPAMERRLOGLEN=0" >> "$GITHUB_ENV" + echo "OPAMPRECISETRACKING=1" >> "$GITHUB_ENV" + echo "OPAMYES=1" >> "$GITHUB_ENV" + + if [[ "$RUNNER_OS" != "Windows" ]]; then + echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV" + else + echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV" + fi + if [[ "$RUNNER_OS" != "Windows" ]]; then OPAM_PATH="$(cat .opam-path)" chmod +x "$OPAM_PATH" dirname "$OPAM_PATH" >> "$GITHUB_PATH" else + fsutil behavior query SymlinkEvaluation + fsutil behavior set symlinkEvaluation R2L:1 R2R:1 + fsutil behavior query SymlinkEvaluation + CYGWIN="winsymlinks:native" CYGWIN_ROOT="D:\\cygwin" - CYGWIN_ROOT_BIN="D:\\cygwin\\bin" + CYGWIN_ROOT_BIN="D:\\cygwin/bin" CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin" + echo "HOME=$USERPROFILE" >> "$GITHUB_ENV" + echo "MSYS=winsymlinks:native" >> "$GITHUB_ENV" echo "CYGWIN=$CYGWIN" >> "$GITHUB_ENV" echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV" echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV" echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV" - echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH" echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH" fi - - sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV" shell: bash - name: Build compiler @@ -325,7 +354,7 @@ jobs: - name: Install npm packages run: npm ci --ignore-scripts - - name: "Windows: Use MSVC for ninja build" + - name: Setup MSVC for ninja build (Windows) if: runner.os == 'Windows' uses: TheMrMilchmann/setup-msvc-dev@v3 with: diff --git a/ninja/misc/ci.py b/ninja/misc/ci.py index 17cbf14698..0c69d898c6 100755 --- a/ninja/misc/ci.py +++ b/ninja/misc/ci.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import os diff --git a/ninja/misc/output_test.py b/ninja/misc/output_test.py index 1dcde10b03..65438190b6 100755 --- a/ninja/misc/output_test.py +++ b/ninja/misc/output_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python """Runs ./ninja and checks if the output is correct. diff --git a/scripts/buildNinjaBinary.js b/scripts/buildNinjaBinary.js index b8c8fd9a9c..92e3411be2 100755 --- a/scripts/buildNinjaBinary.js +++ b/scripts/buildNinjaBinary.js @@ -5,7 +5,7 @@ const path = require("path"); const platform = process.platform; const ninjaDir = path.join(__dirname, "..", "ninja"); -const buildCommand = "python3 configure.py --bootstrap --verbose"; +const buildCommand = "python configure.py --bootstrap --verbose"; if (platform === "win32") { // On Windows, the build uses the MSVC compiler which needs to be on the path. From 4e4277e72825b5476531a663c92696a83b38f1f6 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 1 Jul 2024 01:41:50 +0900 Subject: [PATCH 21/26] poc: use build image via jobs.container --- .github/workflows/ci.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db909b6c50..69f8d35d42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,27 +103,23 @@ jobs: os: [ubuntu-latest, buildjet-2vcpu-ubuntu-2204-arm] runs-on: ${{matrix.os}} + container: ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Python for ninja build - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Build compiler binaries - uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 - with: - args: opam exec -- dune build --display quiet --profile static + run: | + opam exec -- dune build --display quiet --profile static - name: Build ninja binary - uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 - with: - args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap" + run: | + cd ninja + LDFLAGS=-static python configure.py --bootstrap + cd .. - - name: "Upload artifacts" + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: static-binaries-linux-${{runner.arch}} From 6c8cba199f06b8853e3d80d15ecaf135d893e9bf Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 1 Jul 2024 01:46:37 +0900 Subject: [PATCH 22/26] Revert "poc: use build image via jobs.container" This reverts commit 4e4277e72825b5476531a663c92696a83b38f1f6. The custom container feature seems to have some compatibility issues and doesn't provide any additional optimization anyway --- .github/workflows/ci.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69f8d35d42..db909b6c50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,23 +103,27 @@ jobs: os: [ubuntu-latest, buildjet-2vcpu-ubuntu-2204-arm] runs-on: ${{matrix.os}} - container: ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 steps: - name: Checkout uses: actions/checkout@v4 + - name: Setup Python for ninja build + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Build compiler binaries - run: | - opam exec -- dune build --display quiet --profile static + uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 + with: + args: opam exec -- dune build --display quiet --profile static - name: Build ninja binary - run: | - cd ninja - LDFLAGS=-static python configure.py --bootstrap - cd .. + uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 + with: + args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap" - - name: Upload artifacts + - name: "Upload artifacts" uses: actions/upload-artifact@v4 with: name: static-binaries-linux-${{runner.arch}} From 173a60c1bafc6e9c7d6248bf1b90ede6ea1ee94e Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 1 Jul 2024 01:51:50 +0900 Subject: [PATCH 23/26] remove unnecessary setup-python --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db909b6c50..613b6f28d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,11 +108,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup Python for ninja build - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Build compiler binaries uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 with: From 27b8ee47aba57418ecb8d720027dfb6c49cce61c Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 1 Jul 2024 02:01:06 +0900 Subject: [PATCH 24/26] fix a wrong path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 613b6f28d6..4e192b6f5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -323,7 +323,7 @@ jobs: CYGWIN="winsymlinks:native" CYGWIN_ROOT="D:\\cygwin" - CYGWIN_ROOT_BIN="D:\\cygwin/bin" + CYGWIN_ROOT_BIN="D:\\cygwin\\bin" CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin" echo "HOME=$USERPROFILE" >> "$GITHUB_ENV" From 6f4de5cc6782ed8774ea5d4bf0c0967da613f083 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 1 Jul 2024 02:36:05 +0900 Subject: [PATCH 25/26] what was happened --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e192b6f5b..4ba8ed0f49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -323,7 +323,7 @@ jobs: CYGWIN="winsymlinks:native" CYGWIN_ROOT="D:\\cygwin" - CYGWIN_ROOT_BIN="D:\\cygwin\\bin" + CYGWIN_ROOT_BIN="D:\\cygwin/bin" CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin" echo "HOME=$USERPROFILE" >> "$GITHUB_ENV" @@ -332,7 +332,7 @@ jobs: echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV" echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV" echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV" - echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH" + # echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH" echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH" fi shell: bash From 48bce88b1c3d09dc114f3171edd3441a9d2954d8 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 1 Jul 2024 02:44:39 +0900 Subject: [PATCH 26/26] fine --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ba8ed0f49..00fc84d38a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -323,7 +323,7 @@ jobs: CYGWIN="winsymlinks:native" CYGWIN_ROOT="D:\\cygwin" - CYGWIN_ROOT_BIN="D:\\cygwin/bin" + CYGWIN_ROOT_BIN="D:\\cygwin\\bin" CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin" echo "HOME=$USERPROFILE" >> "$GITHUB_ENV" @@ -332,7 +332,7 @@ jobs: echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV" echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV" echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV" - # echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH" + echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH" fi shell: bash