Giter Site home page Giter Site logo

lean-action's People

Contributors

austinletson avatar dependabot[bot] avatar oliver-butterley avatar seasawher avatar semorrison avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lean-action's Issues

Parameterize functional tests by lean version.

Currently functional tests use 4.8.0.
We want a way to run the functional test suite with any version of lean:

  • to make updating lean-action between lean versions easier (ideally there would be nothing to update in the lean-action repo when an new version of lean is released).
  • to support multiple versions of lean with confidence.

Problem about caching strategy for Lean

Note: This is based on my assumptions and might not be entirely accurate.

This issue occurs when we update our project from v4.9.0-rc1 to v4.9.0-rc2. FormalizedFormalLogic/Foundation#85
And it seems to be happens same problem branch in the nightly branch of the import-graph.

In our project, we set the GitHub Action cache strategy as follows

path: .lake
key: lake-${{ runner.os }}-${{ hashFiles('lake-manifest.json') }}-${{ github.ref }}
restore-keys: |
    lake-${{ runner.os }}-${{ hashFiles('lake-manifest.json') }}-${{ github.ref }}
    lake-${{ runner.os }}-${{ hashFiles('lake-manifest.json') }}
    lake-${{ runner.os }}

The problem we encountered was with the restore-keys we specified. The issue is that when updating the Lean version itself, the previous version's cache also becomes a fallback candidate. In our project, it seems we referenced the v4.9.0-rc1 cache, which caused the build to fail.

Solution is remove fallbacks of restore-keys to lake-${{ runner.os }}-${{ hashFiles('lake-manifest.json') }}-${{ github.ref }} only.

Currently, the cache strategy of this action is similar (i.e., it doesn't avoid using the cache when the Lean version itself is updated).

lean-action/action.yml

Lines 93 to 99 in 52906d4

- uses: actions/cache@v4
if: ${{ inputs.use-github-cache == 'true' }}
with:
path: ${{ inputs.lake-package-directory }}/.lake
key: ${{ runner.os }}-lake-${{ github.sha }}
# if no cache hit, fall back to the (latest) previous cache
restore-keys: ${{ runner.os }}-lake-

This seems to be why the nightly branch of the import-graph is broken.
As a solution, specifying ${{ hashFiles('lean-toolchain') }} as the key should work.

bug: run `lake update` and `lean-action` gets an error

This workflow raise an error: https://github.com/lean-ja/lean-by-example/actions/runs/9530357340/workflow
The workflow content is simple: Just install elan, run lake update and then lean-action.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v4

      # - name: update lean-toolchain
      #   run: |
      #     LATEST_LEAN=$(gh release list --repo leanprover/lean4 --limit 1 | awk '{print $1}')
      #     echo "The latest release/prerelase is: $LATEST_LEAN"
      #     echo "leanprover/lean4:$LATEST_LEAN" > lean-toolchain
      #   env:
      #     GH_TOKEN: ${{ github.token }}
      #   shell: bash

      - name: Install elan
        run: |
          curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y
          echo "$HOME/.elan/bin" >> $GITHUB_PATH
        shell: bash

      - name: Update dependencies of ${{ github.repository }}
        run: lake update
        shell: bash

      - name: build lean
        uses: leanprover/lean-action@main
        with:
          test: false

You can see error details: https://github.com/lean-ja/lean-by-example/actions/runs/9530357340/job/26270125659

error message:

▼ Run : Get Mathlib Cache
  : Get Mathlib Cache
  echo "::group::Mathlib Cache"
  lake exe cache get
  echo "::endgroup::"
  echo
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
▼ Mathlib Cache
  info: mdgen: updating repository '././.lake/packages/mdgen' to revision '6a6a412465e82572f6e30385592eac52ab055c83'
  info: mathlib: updating repository '././.lake/packages/mathlib' to revision '03092720f68254315c95a5bf2[49](https://github.com/lean-ja/tactic-cheatsheet/actions/runs/9530357340/job/26270125659#step:5:55)c5f2cdef717d6'
  error: external command 'git' exited with code 1
  Error: Process completed with exit code 1.

I have no idea what caused it.

Use `lake check-test` to detect absence of a test runner

lake check-test will return exit code 1 if no test runner is available.

When lean-action tries to run tests, we should check this first, and provide a helpful error message. (For now, as the test framework is changing quickly, it doesn't need to be particularly helpful! Later we can point to some proper documentation on how to set up test runners.)

Enhance version information logging

Add a step to lean-action (ideally after detect mathlib) to log:

  • Lean version
  • Lake version
  • Whether the project is downstream of mathlib

This aligns with logging practices in existing Lean CI workflows (e.g., import-graph).

Redundant mathlib caching

One area for improvement is that currently the action caches the mathlib cache generated by lake exe cache get which seems redundant and takes up significant space in the GitHub cache.

One potential fix for this would be to exclude certain subfolders of .lake from the cache. This behavior of the cache action may be relevant.

Document use cases where additional Lean CI steps are taken after `lean-action`

In many cases, Lean developers will want to run additional Lean related CI steps after lean-action runs which take advantage of the features of lean-action. For instance in import-graph, there is a step to verify lake exe graph which uses the elan setup and .lake caching features from lean-action (see leanprover-community/import-graph#9).

The lean-action README.md should document where this is possible and give examples.

Automatically check if test runner is available

Automatically checks if test_driver or test_runner is defined in lakefile.lean and executes lake test if it is defined, otherwise does not.

It would be tedious to have the user manually enter whether or not to run lake test each time. default input should be auto.

v1-beta release

  • Create a release/v1-beta branch for the release candidate.
  • Run functional_tests.yml workflow on release/v1-beta.
  • Test release/v1-beta on existing test projects.
  • Create a release of release/v1-beta with a v1-beta tag.
    • Copy the release notes from the ## Unreleased section of CHANGELOG.md.
  • Verify action with uses: leanprover/lean-action@v1-beta.
  • Create a PR to update README.md and CHANGELOG.md.

Automatically detect module for `lake exe runLinter`

Instead of users manually providing a module to lint with the lint-module input, automatically detect which module to lint.

Depending on how this automatic detection works, we may still want to allow users to manually specify which module to lint.

Create `auto-config` input

Create auto-config input to allow users to specify if lean-action should use the Lake workspace (or grep in some cases) to determine a configuration for lean-action.

Related: #30, #46, #53

This feature still needs to be fleshed out.

Support repositories with subdirectory Lean packages

Some projects contain Lean packages within a subdirectory of the GitHub repository (e.g. cedar-spec).

Two ways to potentially support this case:

  • Document how users can leverage the working-directory feature of GitHub workflows to achieve this behavior (this seems preferable if it works properly)
  • Add input to specify the directory which lean-action should run

v1-beta.1 release

  • Create a release/v1-beta.1 branch off of main for the release candidate.
  • Testing
    • Run functional_tests.yml workflow on release/v1-beta.1.
    • Test release/v1-beta on existing test projects (Given that the automated functional tests cover much of the original manual functional test suite, this is more of a sanity check).
  • Create a release of release/v1-beta.1 with a v1-beta.1 tag.
    • Copy the release notes from the ## Unreleased section of CHANGELOG.md.
  • Git tag manipulation.
    • Create a v1-beta.0 tag to point to v1-beta to preserve a tag to the last release.
    • Move the v1-beta tag to point to v1-beta.1.
  • Verify action with uses: leanprover/lean-action@v1-beta.
  • Create a PR to update README.md and CHANGELOG.md.
  • Post in Zulip
  • Create an issue to update RELEASING.md with improvements to the release process and add a template for release issues.

Inconsistency with `mathlib-cache` input

The current situation is:

mathlib-cache:
    description: |
      Run "lake exe cache get" before build.
      Project must be downstream of Mathlib.
      Allowed values: "true" or "false".
      If mathlib-cache input is not provided, the action will attempt to automatically detect if the project is downstream of Mathlib.
    required: false
    default: ""
    - name: detect mathlib
      # only detect Mathlib if the user did not provide the mathlib-cache input
      if: ${{ inputs.mathlib-cache == '' }}
      # etc...

An input here of either "true" or "false" will have the same effect. Possible solutions:

  • the description of the input is changed,
  • or, set required: true and default: false for this input and change the conditional to ${{ inputs.mathlib-cache == 'false' }}

Style note: could be clearer for the input name to be "get-mathlib-cache" or "use-mathlib-cache". (At the moment "mathlib-cache: true" could be understood to mean that the action can expect mathlib-cache to have already been obtained in a step prior to lean-action.)

Save cache even if a build fails

We should be able to save the cache even if a build fails similar to this example.

For reference, here is the initial discussion where we explored the now unsupported save-always flag.

v1-alpha release

  • Align on features to include in `leanprover/lean-action@v1-alpha
  • Create release/v1-alpha branch for release candidate
  • Test release/v1-alpha on existing test projects
  • Create release of release/v1-alpha with v1-alpha tag
  • Verify action with uses: leanprover/lean-action@v1-alpha

v1.0.0 release

v1.0.0 release

  • Create a release/v1.0.0 branch off of main for the release candidate.
  • Testing
    • Run functional_tests.yml workflow on release/v1.0.0.
  • Create a GitHub release of release/v1.0.0 with a v1.0.0 tag.
    • Copy the release notes from the ## Unreleased section of CHANGELOG.md.
  • Git tag manipulation.
    • Create a git tag named v1.0.0 pointing to the release/v1.0.0 branch
    • Create a new git tag named v1.
    • Move the v1 tag to point to release/v1.0.0.
  • Verify action with uses: leanprover/[email protected] in test repo as a sanity check.
  • Create a PR to:
    • Create a PR to update CHANGELOG.md with the latest release.
    • Update instances of leanprover/lean-action@{{MAJOR_SPECIFIC_RELEASE}} in README.md.
  • Post release announcement in general/lean-action Zulip topic.

Std is renamed Batteries

    # Run "lake exe runLinter" on the specified module.
    # Project must be downstream of Std.
    # Allowed values: name of module to lint.
    # If lint-module input is not provided, linter will not run.
    lint-module: ""

Fix GitHub cache keys to reduce problems with the cache when updating Lean version

The GitHub cache can cause problems when updating Lean version. To fix this and improve the overall caching strategy, we can add hashes of the lean-toolchain and lake-manifest.json files to the cache keys to narrow cache hits to runs of lean-action with the same toolchain and lake manifest.

In action.yml,

  • update the - uses: actions/cache@v4 step to use the following key and restore-key inputs:
key: lake-${{ runner.os }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ github.sha }}
restore-keys: lake-${{ runner.os }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}
  • update the - uses: actions/cache/save@v4 step to use the following key input:
key: lake-${{ runner.os }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ github.sha }}

See #62 and #64 for original bug reports

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.