ocurl->curl #520
Workflow file for this run
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
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_details: | |
runs-on: ubuntu-latest | |
outputs: | |
packages: ${{ steps.packages.outputs.packages }} | |
should_run: ${{ steps.packages.outputs.should_run }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Grab packages to build | |
id: packages | |
run: | | |
PACKAGES_TO_RUN=$(OUTPUT_ONLY=true ./tests/run_tests.sh | while read i; do echo "\\\"$i\\\""; done | xargs | sed -e 's# #,#g' | tr -d '\n') | |
SHOULD_RUN=$(if [ -n "${PACKAGES_TO_RUN}"]; then echo "false"; else echo "true"; fi) | |
echo "Packages to run: ${PACKAGES_TO_RUN}" | |
echo "packages=[${PACKAGES_TO_RUN}]" >> "${GITHUB_OUTPUT}" | |
echo "should_run=${SHOULD_RUN}" >> "${GITHUB_OUTPUT}" | |
build_package: | |
runs-on: ubuntu-latest | |
needs: build_details | |
if: needs.build_details.outputs.should_run == 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{ fromJson(needs.build_details.outputs.packages) }} | |
# ocaml compiler 4.14.1 does not have an option to build in 32 bit mode anymore. | |
arch: [x64] | |
ocaml_version: [4.14.1, 5.1.1] | |
container: | |
image: ocamlcross/windows-${{ matrix.arch }}-base:${{ matrix.ocaml_version }} | |
options: --user root | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build package | |
env: | |
PKG_CONFIG_PATH: ${{ matrix.arch == 'x64' && '/usr/src/mxe/usr/x86_64-w64-mingw32.static/lib/pkgconfig/' || '/usr/src/mxe/usr/i686-w64-mingw32.static/lib/pkgconfig/' }} | |
TOOLPREF64: /usr/src/mxe/usr/bin/x86_64-w64-mingw32.static- | |
TOOLPREF32: /usr/src/mxe/usr/bin/i686-w64-mingw32.static- | |
run: | | |
rm -rf /home/opam/opam-cross-windows/packages /home/opam/opam-cross-windows/repo | |
mv packages /home/opam/opam-cross-windows | |
mv repo /home/opam/opam-cross-windows | |
sudo -u opam opam update | |
sudo -u opam opam list --short --recursive --external --vars os-distribution=mxe,os-family=mingw --required-by=${{ matrix.package }} > /home/opam/mxe-deps | |
if [ -s /home/opam/mxe-deps ]; then | |
cd /usr/src/mxe/ && cat /home/opam/mxe-deps | xargs make | |
fi | |
eval $(sudo -u opam opam env) | |
sudo -u opam opam reinstall --verbose -y ${{ matrix.package }} ocaml-windows.${{ matrix.ocaml_version }} | |
- name: Export revdeps | |
id: revdeps | |
if: matrix.arch == 'x64' | |
run: | | |
eval $(sudo -u opam opam env) | |
BASE_PACKAGE=$(echo ${{ matrix.package }} | cut -d'.' -f 1) | |
REVDEPS_TO_BUILD=$(sudo -u opam opam list --rec --short --sort --depends-on=${{ matrix.package }} | grep -v "${BASE_PACKAGE}" | while read i; do echo "\\\"$i\\\""; done | xargs | sed -e 's# #,#g' | tr -d '\n') | |
echo "Revdeps to build: ${REVDEPS_TO_BUILD}" | |
echo "revdeps=[${REVDEPS_TO_BUILD}]" >> "${GITHUB_OUTPUT}" | |
- name: Write matrix output | |
if: matrix.arch == 'x64' && matrix.ocaml_version == '5.1.1' | |
id: matrix_output | |
uses: cloudposse/github-action-matrix-outputs-write@main | |
with: | |
matrix-step-name: ${{ github.job }} | |
matrix-key: ${{ matrix.package }} | |
outputs: |- | |
revdeps: ${{ steps.revdeps.outputs.revdeps }} | |
collect_revdeps: | |
runs-on: ubuntu-latest | |
needs: [build_package] | |
outputs: | |
revdeps: ${{ steps.revdeps.outputs.revdeps }} | |
has_revdeps: ${{ steps.revdeps.outputs.has_revdeps }} | |
steps: | |
- name: Collect revdeps | |
uses: cloudposse/github-action-matrix-outputs-read@main | |
id: collect_revdeps | |
with: | |
matrix-step-name: build_package | |
- name: Export all revdeps | |
uses: satackey/[email protected] | |
id: revdeps | |
with: | |
script: | | |
const core = require("@actions/core") | |
const { revdeps } = JSON.parse('${{ steps.collect_revdeps.outputs.result }}') | |
const result = Object.keys(revdeps).reduce((result, key) => | |
[...result, ...revdeps[key]], []); | |
console.log(`Collected revdeps: ${result}`); | |
core.setOutput("revdeps", JSON.stringify(result)); | |
core.setOutput("has_revdeps", result.length !== 0); | |
build_revdeps: | |
runs-on: ubuntu-latest | |
needs: collect_revdeps | |
if: needs.collect_revdeps.outputs.has_revdeps == 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{ fromJson(needs.collect_revdeps.outputs.revdeps) }} | |
arch: [x64] | |
ocaml_version: [4.14.1, 5.1.1] | |
container: | |
image: ocamlcross/windows-${{ matrix.arch }}-base:${{ matrix.ocaml_version }} | |
options: --user root | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build revdep | |
env: | |
PKG_CONFIG_PATH: ${{ matrix.arch == 'x64' && '/usr/src/mxe/usr/x86_64-w64-mingw32.static/lib/pkgconfig/' || '/usr/src/mxe/usr/i686-w64-mingw32.static/lib/pkgconfig/' }} | |
TOOLPREF64: /usr/src/mxe/usr/bin/x86_64-w64-mingw32.static- | |
TOOLPREF32: /usr/src/mxe/usr/bin/i686-w64-mingw32.static- | |
run: | | |
rm -rf /home/opam/opam-cross-windows/packages /home/opam/opam-cross-windows/repo | |
mv packages /home/opam/opam-cross-windows | |
mv repo /home/opam/opam-cross-windows | |
sudo -u opam opam update | |
sudo -u opam opam list --short --recursive --external --vars os-distribution=mxe,os-family=mingw --required-by=${{ matrix.package }} > /home/opam/mxe-deps | |
if [ -s /home/opam/mxe-deps ]; then | |
cd /usr/src/mxe/ && cat /home/opam/mxe-deps | xargs make | |
fi | |
eval $(sudo -u opam opam env) | |
sudo -u opam opam reinstall --verbose -y ${{ matrix.package }} ocaml-windows.${{ matrix.ocaml_version }} |