From ead2b76050334d9ae19c61dc5b226491bf0b59f7 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Tue, 13 Jul 2021 15:42:20 +0200 Subject: [PATCH] Switch to github actions wrt #178 and #159 --- .github/release.yaml | 109 +++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 37 --------------- .travis/build.sh | 28 ----------- 3 files changed, 109 insertions(+), 65 deletions(-) create mode 100644 .github/release.yaml delete mode 100644 .travis.yml delete mode 100755 .travis/build.sh diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 0000000..0f7d467 --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,109 @@ +name: Create Release + +on: + push: + tags: + - 'v*' + +jobs: + draft_release: + name: Create Release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + Changes in this Release + - First Change + - Second Change + draft: true + prerelease: false + + release-mac: + name: Create Release for macOS + needs: draft_release + runs-on: ${{ matrix.os }} + env: + MACOSX_DEPLOYMENT_TARGET: 10.13 + strategy: + matrix: + os: + - macOS-10.15 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: haskell/actions/setup@v1.2 + with: + ghc-version: 8.10.4 + cabal-version: 3.4.0.0 + + - name: create ~/.local/bin + run: mkdir -p "$HOME/.local/bin" + shell: bash + + - name: Add ~/.local/bin to PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + shell: bash + + - name: Update cabal cache + run: cabal update + shell: bash + + - name: Install cabal dependencies + run: cabal build --only-dependencies + shell: bash + + - name: Build + run: cabal build -w ghc-${GHC_VERSION} --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" -ftui + shell: bash + + - name: Install + run: cp "$(cabal list-bin exe:ghcup)" ~/.local/bin/ghcup + shell: bash + + - name: Strip + run: strip ~/.local/bin/ghcup + shell: bash + + - name: Run tests + run: cabal test --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" all + shell: bash + + - name: Install git + run: brew install git + + - name: set HOME + run: echo "HOME=$HOME" >> $GITHUB_ENV + shell: bash + + - name: Set ASSET_PATH + run: echo "ASSET_PATH=$HOME/.local/bin/ghcup" >> $GITHUB_ENV + shell: bash + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.draft_release.outputs.upload_url }} + asset_path: ${{ env.ASSET_PATH }} + asset_name: ghcup-${{ matrix.os }} + asset_content_type: application/octet-stream + + - if: always() + uses: actions/upload-artifact@v2 + with: + name: plan.json + path: ./dist-newstyle/cache/plan.json + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f29e750..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -jobs: - include: - - os: osx - osx_image: xcode8 - language: generic - env: ARTIFACT=x86_64-apple-darwin-10.11-ghcup - - - os: osx - osx_image: xcode10.1 - language: generic - env: ARTIFACT=x86_64-apple-darwin-10.13-ghcup - - - os: osx - osx_image: xcode11.3 - language: generic - env: ARTIFACT=x86_64-apple-darwin-10.14-ghcup - - allow_failures: - - os: osx - osx_image: xcode8 - language: generic - env: ARTIFACT=x86_64-apple-darwin-10.11-ghcup - - -script: ".travis/build.sh" - -deploy: - provider: releases - api_key: - secure: GQESg4TcYf3PQJRRaZV/kWS0hsF+OFnH2+EcwpgnIcfx4+aogMyprdh745KtBXe1FlFN1luKHksFjqceqhcg/xcNyeCJiSnLWMn4D/i4WUperEHseRBi5yZZCB1AvOjIlHrE4DS3a8pyEm1GV3G7CKY5Fu8jBjof2SnyENfd7fofhjtNHWmeFS+jBn8HRDf1YaSRYxzTw6uHLrPLsybfgQZVl7babMu/38Ghin0f5pz5OlNokzDxaubIYQHOZ7st7YndHJtBWWql/KualBWbMILy88dUVQBnbqQLP2P8d1ME8ILUjJVqz33HiRU0JzlEJyWfbvEjcJ6iD8M6n4nXTaxfu3i2UhhGsQ6SSBNKssMP4tji8nkNpMqG59wLQ/zhcetEm71fKkgJNrIMNllkqlWSo5K74IqqP9kiLg/qm8ipOJjui0gPk8tZXKcV+ztX1d1OVCapoLfiDM5l/0LLQXaTOXOV1x3e5LLQ/w2doNiH3eh5CV4II9dRu7owpaiiMBHMssmT0pH99jEeF6giHLKtt3y7l2GWoRLPdhsZZ54gxsaBxZt9GuypmkbNcr97CEnAVaWij5v0CF3w4rAWqy/tAxQpIDJOIOQBgmwG5WrBAKyKrFvEpBL5a8BPcRWJDvqKC83QeWpvPrEVdgJevC6ZN1MKzrb2SiPOwC2Kerc= - file: $ARTIFACT - on: - repo: haskell/ghcup-hs - tags: true - skip_cleanup: true - draft: true - diff --git a/.travis/build.sh b/.travis/build.sh deleted file mode 100755 index 19548e9..0000000 --- a/.travis/build.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -set -ex - -mkdir -p ~/.ghcup/bin -curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup -chmod +x ~/.ghcup/bin/ghcup - -export PATH="$HOME/.ghcup/bin:$PATH" - -ghcup install 8.10.4 -ghcup install-cabal 3.4.0.0 -ghcup set 8.10.4 - - -## install ghcup - -cabal update - -( - cd /tmp - cabal install --installdir="$HOME"/.ghcup/bin hspec-discover -) - -cabal build --constraint="zlib +static" --constraint="lzma +static" -ftui -cp "$(cabal new-exec --verbose=0 --offline sh -- -c 'command -v ghcup')" . -strip ./ghcup -cp ghcup "./${ARTIFACT}"