diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fd44695 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,79 @@ +name: CI + +on: + pull_request: + push: + branches: [master] + release: + types: [published] + +env: + BUNDLE_DIR: bundle + +jobs: + build_server: + name: Build server + # Note that this must be kept in sync with the version of Ubuntu which the + # Pursit server is running, otherwise the server binary may fail to run. + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - uses: haskell/actions/setup@v1 + with: + enable-stack: true + stack-version: "2.5.1" + stack-no-global: true + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.stack + key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock') }}-${{ hashFiles('pursuit.cabal') }} + + - name: Build server code + run: | + stack --no-terminal --jobs=2 build --flag pursuit:-dev --only-dependencies --fast + + - name: Test server code + run: | + stack --no-terminal --jobs=2 test --flag pursuit:-dev --pedantic --only-dependencies --fast + + - name: Build server assets + if: github.event_name == 'release' + run: | + mkdir ${{ env.BUNDLE_DIR }} + cp $(stack path --dist-dir)/build/pursit/pursuit ${{ env.BUNDLE_DIR }}/ + cp LICENSE ${{ env.BUNDLE_DIR }}/ + cp -r deploy/ ${{ env.BUNDLE_DIR }}/ + tar czf pursuit.tar.gz -C ${{ env.BUNDLE_DIR }}/ . + + - name: Persist server assets + uses: actions/upload-artifact@v2 + if: github.event_name == 'release' + with: + name: pursuit.tar.gz + path: pursuit.tar.gz + retention-days: 1 + + release: + name: Release + # Note that this must be kept in sync with the version of Ubuntu which the + # Pursit server is running, otherwise the server binary may fail to run. + runs-on: ubuntu-18.04 + if: github.event_name == 'release' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + needs: + - build_server + steps: + - name: Retrieve server assets + uses: actions/download-artifact@v2 + with: + name: pursuit.tar.gz + + - name: Upload assets + uses: softprops/action-gh-release@v1 + with: + files: | + pursuit.tar.gz diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c67a549..0000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: generic - -cache: - # Our caches are large, and take long enough to upload that we sometimes hit - # the default timeout of 180s, so we extend it here - timeout: 1500 - directories: - - $HOME/.stack - -branches: - # Only build master and tagged versions, i.e. not feature branches; feature - # branches already get built after opening a pull request. - only: - - master - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - -addons: - apt: - packages: - - libgmp-dev - -before_install: - - mkdir -p ~/.local/bin - - export PATH=$HOME/.local/bin:$PATH - -script: - - ./travis/timeout.sh ./travis/script.sh - -notifications: - email: true - -before_deploy: - - mkdir bundle - - cp `stack path --dist-dir`/build/pursuit/pursuit bundle/ - - cp LICENSE bundle/ - - cp -r deploy/ bundle/ - - tar czf pursuit.tar.gz -C bundle/ . - -deploy: - provider: releases - api_key: $RELEASE_KEY - file: pursuit.tar.gz - skip_cleanup: true - on: - tags: true diff --git a/README.md b/README.md index 34c46f8..81cbe2e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Pursuit -[![Build Status](https://api.travis-ci.org/purescript/pursuit.svg?branch=master)](https://travis-ci.org/purescript/pursuit) +[![Build Status](https://github.com/purescript/pursuit/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/pursuit/actions?query=workflow%3ACI+branch%3Amaster) Pursuit hosts API documentation for PureScript packages. It lets you search by package, module, and function names, as well as approximate type signatures. @@ -95,7 +95,7 @@ application, and contains files which do not change and may be served as-is without forwarding the request on to the Yesod application. See Handler.Caching for more details. -The `verified/` directory stores uploaded packages. Each package has its own +The `verified/` directory stores uploaded packages. Each package has its own directory, and then there is a JSON file for each version. These JSON files each contain a serialized `Package GithubUser`; see Language.PureScript.Docs.Types in the compiler for details about these types. diff --git a/travis/script.sh b/travis/script.sh deleted file mode 100755 index 9aa2fba..0000000 --- a/travis/script.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -ex - -curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' -stack setup -stack --version - -if [ -z "$TRAVIS_TAG" ] -then - STACK_EXTRA_FLAGS="--fast" -fi - -stack --no-terminal --jobs=2 build \ - --flag pursuit:-dev \ - --only-dependencies \ - $STACK_EXTRA_FLAGS -stack --no-terminal --jobs=2 test \ - --flag pursuit:-dev \ - --pedantic \ - $STACK_EXTRA_FLAGS diff --git a/travis/timeout.sh b/travis/timeout.sh deleted file mode 100755 index 89a1724..0000000 --- a/travis/timeout.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -timeout 40m $@ -ret=$? -case "$ret" in - 0) - # continue - ;; - 124) - echo "Timed out while executing command: $@." - echo "Try building again by pushing a new commit." - exit 1 - ;; - *) - exit "$ret" - ;; -esac