- meaning & definition #1323
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by https://tech.freckle.com/2021/05/18/haskell-on-actions/ | |
name: Build and test 🚀 | |
on: | |
push: | |
branches: | |
- "**" # Only trigger on branches (i.e. not tags, ..) | |
paths-ignore: | |
- "docs/**" # If only documentation changes, no need to build. | |
jobs: | |
build-and-test-docker: | |
name: Build with Docker | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_AMPERSAND_IMAGE: ampersandtarski/ampersand | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Prepare for docker | |
run: | | |
echo Running on branch ${GITHUB_REF##*/} | |
docker version | |
- name: Build final image | |
run: docker build . --tag ${DOCKER_AMPERSAND_IMAGE}:latest --build-arg GIT_SHA=${{ github.sha }} --build-arg GIT_Branch=${{ github.ref }} | |
# For main branch push latest to DockerHub | |
- name: Login to DockerHub | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Push latest | |
if: github.ref == 'refs/heads/main' | |
run: docker push ${DOCKER_AMPERSAND_IMAGE}:latest | |
build-and-test-ubuntu: | |
name: Build and test on ubuntu-latest 🏗 🧪 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project contents 📡 | |
uses: actions/checkout@v3 | |
- name: Set up Mariadb 🧰 | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "mariadb-10.6" | |
- name: Build and test 🏗 🧪 | |
uses: freckle/stack-action@v5 # stack-action does all these steps: dependencies, build, test. | |
with: | |
stack-build-arguments: "--copy-bins --flag ampersand:buildAll" | |
upgrade-stack: false | |
cache-save-always: true | |
build-and-test-macOS: | |
name: Build and test on macOS 🏗 🧪 | |
runs-on: macos-12 | |
steps: | |
- name: Checkout project contents 📡 | |
uses: actions/checkout@v3 | |
- name: Use cache when available 📦 | |
uses: freckle/stack-cache-action@main | |
- name: Set up Mariadb 🧰 | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "mariadb-10.6" | |
# # See issue https://github.com/freckle/stack-action/issues/80 for why we need to install stack and php as well | |
# - run: curl -sSL https://get.haskellstack.org/ | sh | |
- run: brew install php | |
- name: Build and test 🏗 🧪 | |
uses: freckle/stack-action@v5 | |
with: | |
stack-build-arguments: "--copy-bins --flag ampersand:buildAll" | |
upgrade-stack: false | |
cache-save-always: true | |
build-and-test-windows: | |
name: Build and test on Windows 🏗 🧪 | |
runs-on: windows-latest | |
steps: | |
- name: Checkout project contents 📡 | |
uses: actions/checkout@v3 | |
- name: Use cache (manually) 📦 # See https://github.com/freckle/stack-cache-action/issues/5 | |
uses: actions/[email protected] | |
# TODO: Cache might be done better, see for inspiration: https://github.com/godu/advent-of-code-2020/blob/46796832f59d185457a8edf8de043a54a451d688/.github/workflows/ci.yml | |
with: | |
path: | | |
~/.ghc | |
~/.stack | |
~/.stack-work | |
key: ${{ runner.os }}-stack | |
- name: Set up Mariadb 🧰 | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "mariadb-10.6" | |
- name: Setup PHP 🧰 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.0" | |
extensions: mysqli | |
- name: Build and test 🏗 🧪 | |
uses: freckle/stack-action@v5 | |
with: | |
stack-build-arguments: "--copy-bins --flag ampersand:buildAll" | |
upgrade-stack: false | |
cache-save-always: true |