Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests pass, migrate to GitHub Actions #7

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# The CACHE_VERSION can be updated to force the use of a new cache if
# the current cache contents become corrupted/invalid. This can
# sometimes happen when (for example) the OS version is changed but
# older .so files are cached, which can have various effects
# (e.g. cabal complains it can't find a valid version of the "happy"
# tool).
env:
CACHE_VERSION: 1

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
ghc: ["9.4.8", "9.6.6", "9.8.2"]
cabal: ["3.10.3.0"]

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- uses: actions/cache/restore@v4
name: Restore cabal store cache
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}
restore-keys: |
${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-

- name: Update
run: cabal update
- name: Configure
run: cabal configure --enable-tests
- name: Build
run: cabal build
- name: Run tests
run: cabal test

- uses: actions/cache/save@v4
name: Save cabal store cache
if: always()
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

16 changes: 9 additions & 7 deletions src/Language/Rust/Data/Ident.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ data Ident
= Ident { hash :: {-# UNPACK #-} !Int -- ^ hash for quick comparision
, name :: Name -- ^ payload of the identifier
, raw :: Bool -- ^ whether the identifier is raw
} deriving (Data, Typeable, Generic, NFData)

instance Eq Ident where
x == y = (hash x, name x) == (hash y, name y)

instance Ord Ident where
compare x y = compare (hash x, name x) (hash y, name y)
}
deriving ( Data, Typeable, Generic, NFData
-- | Note that this instance takes the 'raw' field into account, so
-- the identifiers @x@ and @r#x@ are judged /not/ to be equal.
, Eq
-- | Note that this instance takes the 'raw' field into account, so
-- the identifiers @x@ and @r#x@ are judged /not/ to be equal.
, Ord
)

-- | Shows the identifier as a string (for use with @-XOverloadedStrings@)
instance Show Ident where
Expand Down
Loading