From eb148f62a785770b43b07987ce3ae757113abaec Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 2 Jul 2021 14:26:35 -0700 Subject: [PATCH 1/5] Migrate to GitHub Actions --- .github/workflows/ci.yml | 84 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 45 --------------------- README.md | 4 +- travis/script.sh | 21 ---------- travis/timeout.sh | 17 -------- 5 files changed, 86 insertions(+), 85 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml delete mode 100755 travis/script.sh delete mode 100755 travis/timeout.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..101f431 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +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 + # Try PureScript server is running, otherwise the server binary may fail to + # run. + runs-on: ubuntu-20.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 + .stack-work + key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock') }} + restore-keys: | + ${{ runner.os }}-stack + + - 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-20.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 From 728bd26ea5b5a68007018e5df8e243c505c73dfd Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 2 Jul 2021 14:29:23 -0700 Subject: [PATCH 2/5] TPS -> Pursuit --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 101f431..2a25e4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,7 @@ jobs: build_server: name: Build server # Note that this must be kept in sync with the version of Ubuntu which the - # Try PureScript server is running, otherwise the server binary may fail to - # run. + # Pursuit server is running, otherwise the server binary may fail to run. runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 From de493da7e36eca1f70545009726186f4622318d1 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 2 Jul 2021 14:33:27 -0700 Subject: [PATCH 3/5] Use env for runs-on --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a25e4e..0c8b7f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,14 +8,13 @@ on: types: [published] env: + DROPLET_OS: ubuntu-18.04 BUNDLE_DIR: bundle jobs: build_server: name: Build server - # Note that this must be kept in sync with the version of Ubuntu which the - # Pursuit server is running, otherwise the server binary may fail to run. - runs-on: ubuntu-20.04 + runs-on: ${{ env.DROPLET_OS }} steps: - uses: actions/checkout@v2 @@ -64,7 +63,7 @@ jobs: 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-20.04 + runs-on: ${{ env.DROPLET_OS }} if: github.event_name == 'release' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 359ceddaff1981b01d62ea69fa38eb46a026ab3a Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 2 Jul 2021 14:34:52 -0700 Subject: [PATCH 4/5] Or not --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c8b7f8..21231e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,13 +8,14 @@ on: types: [published] env: - DROPLET_OS: ubuntu-18.04 BUNDLE_DIR: bundle jobs: build_server: name: Build server - runs-on: ${{ env.DROPLET_OS }} + # 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 @@ -63,7 +64,7 @@ jobs: 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: ${{ env.DROPLET_OS }} + runs-on: ubuntu-18.04 if: github.event_name == 'release' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d1ce33a98f896c5c55dd30d1f8e7af5b143af4c2 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 2 Jul 2021 15:34:51 -0700 Subject: [PATCH 5/5] Update caching step --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21231e2..fd44695 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,12 +28,8 @@ jobs: - name: Cache dependencies uses: actions/cache@v2 with: - path: | - ~/.stack - .stack-work - key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock') }} - restore-keys: | - ${{ runner.os }}-stack + path: ~/.stack + key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock') }}-${{ hashFiles('pursuit.cabal') }} - name: Build server code run: |