diff --git a/.drom b/.drom index 81afd6dd..fb5dbd1c 100644 --- a/.drom +++ b/.drom @@ -10,7 +10,7 @@ bb11455b9f2433c568303f8f347a0c82:. # begin context for .github/workflows/workflow.yml # file .github/workflows/workflow.yml -aad9973877fd2a2007a0edd3d2dd87cf:.github/workflows/workflow.yml +e19c028c5001efe8207e97273c9a227c:.github/workflows/workflow.yml # end context for .github/workflows/workflow.yml # begin context for .gitignore diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 61e373d4..41cebef5 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -39,12 +39,10 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Retrieve opam cache - uses: actions/cache@v4 - id: cache-opam - with: - path: ~/.opam - key: v4-${{ runner.os }}-superbol-studio-oss-${{ matrix.ocaml-compiler }}-${{ hashFiles('opam/*.opam') }}-skip_tests=${{ matrix.skip_test }}-repo= + - name: Set git user + run: | + git config --global user.name github-actions + git config --global user.email github-actions-bot@users.noreply.github.com - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: avsm/setup-ocaml@v3 @@ -52,30 +50,25 @@ jobs: ocaml-compiler: ${{ matrix.ocaml-compiler }} opam-pin: false - - name: Set git user - run: | - git config --global user.name github-actions - git config --global user.email github-actions-bot@users.noreply.github.com + - name: Retrieve cache of local opam switch + uses: actions/cache@v4 + id: cache-opam + with: + path: _opam + key: v4-${{ runner.os }}-superbol-studio-oss-${{ matrix.ocaml-compiler }}-${{ hashFiles('opam/*.opam') }}-skip_tests=${{ matrix.skip_test }}-repo= # use fields.opam-repo = "git+https://" to add an 'extra' opam repository - run: opam pin add . -y --no-action - if: ${{ ! steps.cache-opam.outputs.cache-hit }} - -# - run: opam depext -y superbol-studio-oss superbol-vscode-platform interop-js-stubs node-js-stubs vscode-js-stubs vscode-languageclient-js-stubs vscode-json vscode-debugadapter vscode-debugprotocol superbol-free superbol_free_lib superbol_preprocs superbol_project cobol_common cobol_parser cobol_ptree ebcdic_lib cobol_lsp ppx_cobcflags pretty cobol_config cobol_indent cobol_indent_old cobol_preproc cobol_data cobol_typeck cobol_unit ez_toml ezr_toml sql_ast sql_parser cobol_cfg -# if: ${{ ! steps.cache-opam.outputs.cache-hit }} - run: | if ${{ matrix.skip_test }} then opam install -y opam/*.opam --deps-only else opam install -y opam/*.opam --deps-only --with-test fi - if: ${{ ! steps.cache-opam.outputs.cache-hit }} + if: steps.cache-opam.outputs.cache-hit != 'true' name: Run opam install -y opam/*.opam --deps-only [ --with-test ] -# - run: opam upgrade --fixup -# if: steps.cache-opam.outputs.cache-hit - # Use fields.build-scripts to add more scripts to convert here - run: dos2unix scripts/*.sh if: matrix.os == 'windows-latest' @@ -160,3 +153,10 @@ jobs: # Use fields.github-workflow-trailer to add a trailer here + + - name: Cleanup local opam switch before caching + run: | + opam pin remove . --yes + opam clean --switch-cleanup --logs + find _opam -type f -a \( -name '*.cmt' -o -name '*.cmti' \) -delete + if: steps.cache-opam.outputs.cache-hit != 'true' diff --git a/.github/workflows/workflow.yml.drom-tpl b/.github/workflows/workflow.yml.drom-tpl index 4a8fd8bf..9718f052 100644 --- a/.github/workflows/workflow.yml.drom-tpl +++ b/.github/workflows/workflow.yml.drom-tpl @@ -38,12 +38,10 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Retrieve opam cache - uses: actions/cache@v4 - id: cache-opam - with: - path: ~/.opam - key: v4-${{ runner.os }}-!{name}-${{ matrix.ocaml-compiler }}-${{ hashFiles('opam/*.opam') }}-skip_tests=${{ matrix.skip_test }}-repo=!(opam-repo) + - name: Set git user + run: | + git config --global user.name github-actions + git config --global user.email github-actions-bot@users.noreply.github.com - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: avsm/setup-ocaml@v3 @@ -51,10 +49,12 @@ jobs: ocaml-compiler: ${{ matrix.ocaml-compiler }} opam-pin: false - - name: Set git user - run: | - git config --global user.name github-actions - git config --global user.email github-actions-bot@users.noreply.github.com + - name: Retrieve cache of local opam switch + uses: actions/cache@v4 + id: cache-opam + with: + path: _opam + key: v4-${{ runner.os }}-!{name}-${{ matrix.ocaml-compiler }}-${{ hashFiles('opam/*.opam') }}-skip_tests=${{ matrix.skip_test }}-repo=!(opam-repo) # use fields.opam-repo = "git+https://" to add an 'extra' opam repository ![if:field:opam-repo] @@ -64,22 +64,15 @@ jobs: ![fi] - run: opam pin add . -y --no-action - if: ${{ ! steps.cache-opam.outputs.cache-hit }} - -# - run: opam depext -y !{packages} -# if: ${{ ! steps.cache-opam.outputs.cache-hit }} - run: | if ${{ matrix.skip_test }} then opam install -y opam/*.opam --deps-only else opam install -y opam/*.opam --deps-only --with-test fi - if: ${{ ! steps.cache-opam.outputs.cache-hit }} + if: steps.cache-opam.outputs.cache-hit != 'true' name: Run opam install -y opam/*.opam --deps-only [ --with-test ] -# - run: opam upgrade --fixup -# if: steps.cache-opam.outputs.cache-hit - # Use fields.build-scripts to add more scripts to convert here - run: dos2unix scripts/*.sh !(build-scripts) if: matrix.os == 'windows-latest' @@ -125,3 +118,10 @@ jobs: # Use fields.github-workflow-trailer to add a trailer here !(github-workflow-trailer) + + - name: Cleanup local opam switch before caching + run: | + opam pin remove . --yes + opam clean --switch-cleanup --logs + find _opam -type f -a \( -name '*.cmt' -o -name '*.cmti' \) -delete + if: steps.cache-opam.outputs.cache-hit != 'true'