Git Product home page Git Product logo

fourmolu-action's Introduction

DEPRECATED - DO NOT USE

This was a temporary fork that is no longer used or maintained.

Fourmolu action

CI

This Fourmolu Action helps to ensure that your Haskell project is formatted with Fourmolu. The action tries to find all Haskell source code files in your repository and fails if any of them are not formatted. In case of failure it prints the diff between the actual contents of the file and its formatted version.

Example usage

In the simple case all you need to do is to add this step to your job:

- uses: fourmolu/fourmolu-action@v1

The @v1 after fourmolu-action should be replaced with the version of the Fourmolu Action you want to use. See Releases for all versions available. Each version of the Fourmolu Action generally has a corresponding version of fourmolu. Make sure you pick a Fourmolu Action version that uses the version of fourmolu you use locally.

Full example

Here's a full YAML file you can copy and paste into your repo that runs fourmolu-action. Add this as a file like .github/workflows/fourmolu.yaml. This Workflow will run everytime you push to a branch.

name: fourmolu
on: push
jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      # Note that you must checkout your code before running fourmolu/fourmolu-action
      - uses: actions/checkout@v2
      - uses: fourmolu/fourmolu-action@v1

Example with more Options

Here's a more complicated example that shows more options being used:

- uses: fourmolu/fourmolu-action@v1
  with:
    # Only check the format of .hs in the src/ directory.
    pattern: |
      src/**/*.hs

    # Don't follow symbolic links to .hs files.
    follow-symbolic-links: false

    # Extra args to pass to fourmolu on the command line.
    extra-args: "--indent-wheres true"

Example usage with build matrix

If you are using a build matrix, then it is more efficient to have a separate job for checking of formatting:

jobs:
  fourmolu:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: fourmolu/fourmolu-action@v1
  build:
    runs-on: ubuntu-latest
    needs: fourmolu
    ...

Here, the build job depends on fourmolu and will not run unless fourmolu passes.

Options

The available options are defined in ./action.yml. See that file for more explanation.

Hacking on this repo

In order to do development on this repo, you first need to install NodeJS and npm to your system. This has been confirmed to work with the following versions, but newer (or slightly older) versions may work as well:

  • NodeJS: 14.19.1
  • npm: 6.14.16

Next, clone this repo:

$ git clone [email protected]:fourmolu/fourmolu-action.git

Then, within this repo, install all dependencies defined in package.json:

$ npm install

Now, you should be setup to start development. Development consists of hacking on the ./index.js file. After making changes to this file, you'll need to regenerate the files in ./dist/. You can do that with the following command:

$ npm run prepare

When sending a PR, make sure to run npm run prepare and commit the changes to ./dist whenever you make a change in ./index.js.

Making a new release

There is a script to help with making a new release:

$ ./bump.sh

This script bumps the version of fourmolu used by fourmolu-action, and creates a PR for this version bump.

After this PR has been reviewed and merged in, you can create the new Release on GitHub with the following command. Make sure you're on the master branch:

$ ./make-github-release.sh

fourmolu-action's People

Contributors

alexanderharley avatar amesgen avatar cdepillabout avatar jonathanjouty avatar kk-hainq avatar mrkkrp avatar siprj avatar wraithm avatar

Watchers

 avatar

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.