Add changes entry #2311
This file contains hidden or 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: Ppx CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| OPAM_VERSION: 2.3.0 | |
| DUNE_PROFILE: release | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| defaults: | |
| run: | |
| shell: bash -xeuo pipefail {0} | |
| jobs: | |
| build: | |
| name: Build | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] # windows-latest | |
| ocaml-compiler: | |
| - 4.14.1 | |
| - 5.4.0 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| - name: Load opam cache | |
| id: opam-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{ runner.tool_cache }}/opam | |
| ~/.opam | |
| _opam | |
| .opam-path | |
| key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} | |
| - name: Use OCaml ${{ matrix.ocaml-compiler }} | |
| uses: ocaml/setup-ocaml@v3.3.2 | |
| if: steps.opam-cache.outputs.cache-hit != 'true' | |
| with: | |
| ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
| dune-cache: false | |
| opam-disable-sandboxing: true | |
| - name: Get OPAM executable path | |
| if: steps.opam-cache.outputs.cache-hit != 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const opam_path = await io.which('opam', true); | |
| console.log('opam executable found: %s', opam_path); | |
| const Fs = require('fs/promises'); | |
| await Fs.writeFile('.opam-path', opam_path, 'utf-8'); | |
| console.log('stored path to .opam-path'); | |
| - name: Use cached OPAM environment | |
| # if: steps.opam-cache.outputs.cache-hit == 'true' | |
| shell: bash | |
| 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" | |
| echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV" | |
| OPAM_PATH="$(cat .opam-path)" | |
| chmod +x "$OPAM_PATH" | |
| dirname "$OPAM_PATH" >> "$GITHUB_PATH" | |
| - name: Install dependencies | |
| run: make install | |
| - name: Build | |
| run: make build | |
| - name: Test | |
| run: make test | |
| - name: Format | |
| if: matrix.ocaml-compiler == '5.4.0' | |
| run: make format-check | |
| - name: Release static | |
| run: make release-static | |
| - name: Upload artifacts for ${{ matrix.os }} | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.ocaml-compiler == '4.14.1' | |
| with: | |
| name: ${{ matrix.os }} | |
| path: _build/default/packages/bin/bin.exe | |
| - name: Upload runtime artifacts for @davesnx/styled-ppx/runtime | |
| if: matrix.os == 'ubuntu-latest' && matrix.ocaml-compiler == '4.14.1' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: runtime-rescript | |
| path: _build/default/packages/runtime/rescript | |
| - name: Install dune-release | |
| if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' && matrix.ocaml-compiler == '5.4.0' | |
| run: opam install dune-release -y | |
| - name: Release to opam | |
| uses: davesnx/dune-release-action@v0.2.14 | |
| if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' && matrix.ocaml-compiler == '5.4.0' | |
| with: | |
| packages: 'styled-ppx' | |
| changelog: './CHANGES.md' | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| - name: Save opam cache | |
| uses: actions/cache/save@v4 | |
| if: steps.opam-cache.outputs.cache-hit != 'true' | |
| with: | |
| path: | | |
| ${{ runner.tool_cache }}/opam | |
| ~/.opam | |
| _opam | |
| .opam-path | |
| key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} | |
| - name: Save npm cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: node_modules | |
| key: npm-${{ matrix.os }}-${{ hashFiles('package.json') }} | |
| # - name: Run demo tests | |
| # run: make test-demo |