Skip to content

Commit

Permalink
Remove unused credentials. Cache configuration. Fix releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Mar 24, 2021
1 parent e1d3dd3 commit 28ec1bc
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 16 deletions.
186 changes: 170 additions & 16 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ on:
push:
branches:
- main
tags:
- "v*"
pull_request:

jobs:
build:
environment: cabal-cache

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
ghc: ["8.10.4"]
os: [ubuntu-latest]
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v2
Expand All @@ -29,9 +33,10 @@ jobs:
ghc-version: ${{ matrix.ghc }}
cabal-version: 3.4.0.0

- name: Set some window specific things
if: matrix.os == 'windows-latest'
run: echo 'EXE_EXT=.exe' >> $GITHUB_ENV
- name: Cache configuration
run: |
echo "GIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "CACHE_VERSION=3oqhaby" >> $GITHUB_ENV
- name: Configure project
run: cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
Expand All @@ -40,22 +45,93 @@ jobs:
run: |
cat ${{ env.PLAN_JSON }} | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
- uses: actions/cache@v2
name: Cache cabal store
- name: Restore cabal cache
uses: haskell-works/cabal-cache-action@v1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
with:
args: |
sync-from-archive \
--threads "$BINARY_CACHE_THREADS" \
--archive-uri "$BINARY_CACHE_URI" \
--region "$BINARY_CACHE_REGION" \
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
- name: Build dependencies
run: cabal build --dependencies-only --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+

- name: Save cabal cache
uses: haskell-works/cabal-cache-action@v1
if: ${{ always() }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}-${{ env.GITHUB_SHA }}
restore-keys: |
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}-${{ env.GITHUB_SHA }}
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-
args: |
sync-to-archive \
--threads "$BINARY_CACHE_THREADS" \
--archive-uri "$BINARY_CACHE_URI" \
--region "$BINARY_CACHE_REGION" \
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
- name: Build
run: cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+

- name: Save cabal cache
uses: haskell-works/cabal-cache-action@v1
if: ${{ always() }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
with:
args: |
sync-to-archive \
--threads "$BINARY_CACHE_THREADS" \
--archive-uri "$BINARY_CACHE_URI" \
--region "$BINARY_CACHE_REGION" \
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
- name: Test
run: cabal test all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+

- name: Compress Binary
id: compress_binary
env:
GHC_VER: ${{ matrix.ghc }}
run: |
cat dist-newstyle/cache/plan.json | jq -r '
."install-plan"[]
| select(."component-name")
| select(.style == "local")
| select(."component-name" | startswith("exe:"))
| ."bin-file"' > release-files.txt
mkdir -p artifacts
echo "Publishing the following files:"
while IFS= read -r line; do
echo " $line"
cp "$line" artifacts
done < release-files.txt
tar zcvf artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz artifacts
- uses: actions/upload-artifact@v2
with:
name: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz
path: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz

check:
needs: build
runs-on: ubuntu-latest
Expand All @@ -77,10 +153,6 @@ jobs:
- name: Tag new version
id: tag
if: ${{ github.ref == 'refs/heads/main' }}
env:
server: http://hackage.haskell.org
username: ${{ secrets.HACKAGE_USER }}
password: ${{ secrets.HACKAGE_PASS }}
run: |
package_version="$(cat *.cabal | grep '^version:' | cut -d : -f 2 | xargs)"
Expand All @@ -98,10 +170,18 @@ jobs:
fi
fi
- name: Show tag
run: |
echo "Ref: ${{ github.ref }}"
echo "Tag: ${{ steps.tag.outputs.tag }}"
release:
needs: [build, check]
runs-on: ubuntu-latest

if: ${{ needs.check.outputs.tag != '' }}

outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

Expand All @@ -116,3 +196,77 @@ jobs:
cd $PROJECT_DIR && cd `dirname $i`
cabal v2-sdist -o $PROJECT_DIR/build/sdist
done;
- name: Generate Changelog
run: |
git fetch --unshallow
if git describe --tags 'HEAD^' --abbrev=0 > last-tag; then
git log --no-merges --format="%C(auto) %h %s" "$(cat last-tag)..HEAD"
else
git log --no-merges --format="%C(auto) %h %s"
fi > changelog.txt
cat changelog.txt
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.check.outputs.tag }}
release_name: Release ${{ needs.check.outputs.tag }}
draft: false
prerelease: false
body_path: changelog.txt

publish:
needs: [build, release]

runs-on: ${{ matrix.os }}

if: ${{ needs.check.outputs.tag != '' }}

strategy:
fail-fast: false
matrix:
ghc: ["8.10.4"]
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/download-artifact@v2
id: download_artifact
with:
name: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz
path: .

- name: Compute axes
id: axes
run: |
case ${{ matrix.os }} in
ubuntu-*) os="linux" ;;
macos-*) os="darwin" ;;
windows-*) os="windows" ;;
*) exit 1 ;; # error
esac
arch_os="$(uname -m)-$os"
echo "::set-output name=arch_os::$arch_os"
- name: Upload Artifacts to Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz

- name: Upload Artifacts to Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz
asset_name: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz
asset_content_type: application/tar+gzip
12 changes: 12 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
9b65457 Remove unused credentials. Cache configuration. Fix releases.
e1d3dd3 Also add selenium-server-standalone to readme
ff734f9 Fix date selection in gis
be12e7a Fix dayInWeekCsvFile
59f0152 Add --date, --headless, and --exit-delay options.
29eca45 Unused imports
6b42a72 Adjust bounds
49d6300 Add entropy from geol-uoa
5b8bac8 Commands to download and hash NYSE and GIS data
2067a94 Initial main
a8390ea Initial project
db53b90 Initial commit
Empty file added last-tag
Empty file.

0 comments on commit 28ec1bc

Please sign in to comment.