-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #403 from nberth/cache-fix
Cache the local opam switch in CI workflows
- Loading branch information
Showing
3 changed files
with
37 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,43 +39,36 @@ 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 [email protected] | ||
- name: Use OCaml ${{ matrix.ocaml-compiler }} | ||
uses: avsm/setup-ocaml@v3 | ||
with: | ||
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 [email protected] | ||
- 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,23 +38,23 @@ 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 [email protected] | ||
|
||
- name: Use OCaml ${{ matrix.ocaml-compiler }} | ||
uses: avsm/setup-ocaml@v3 | ||
with: | ||
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 [email protected] | ||
- 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' |