Merge pull request #112 from objectionary/rule-2 #158
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
name: GHC (build, test, haddock) | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: [master] | |
tags: [v*] | |
pull_request: | |
branches: [master] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: write # to submit Haddock documentation to GitHub Pages | |
jobs: | |
build: | |
name: "Build and test with GHC" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v4 | |
- uses: haskell-actions/run-fourmolu@v10 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
version: "0.14.0.0" | |
pattern: | | |
eo-phi-normalizer/**/*.hs | |
!eo-phi-normalizer/src/Language/EO/Phi/Syntax/**/*.hs | |
!eo-phi-normalizer/Setup.hs | |
- name: 🧰 Setup Stack | |
uses: freckle/stack-action@v5 | |
with: | |
stack-build-arguments: ${{ github.ref_name != 'master' && '--fast' || '' }} --pedantic | |
pipeline: | |
name: "Run pipeline" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
program: [1] | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v4 | |
- name: 🧰 Setup Stack | |
uses: freckle/stack-action@v5 | |
with: | |
stack-build-arguments: ${{ github.ref_name != 'master' && '--fast' || '' }} --pedantic | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: 21 | |
- name: Install EO | |
run: npm install -g [email protected] | |
- name: Run pipeline | |
run: ./pipeline.sh | |
env: | |
PROGRAM: ${{ matrix.program }} | |
docs: | |
needs: [build] | |
if: ${{ github.ref_name == 'master' }} | |
name: "Build and upload site (master)" | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v4 | |
- name: 🧰 Setup Stack | |
uses: freckle/stack-action@v4 | |
with: | |
test: false | |
- name: 🔨 Build Haddock Documentation (with Stack) | |
run: | | |
stack haddock | |
mkdir -p dist/haddock | |
mv $(stack path --local-doc-root)/* dist/haddock | |
- name: Setup mdBook | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: 'latest' | |
- name: Build site | |
run: | | |
cd site/docs | |
mdbook build | |
mv docs ../../dist | |
cd .. | |
mv index.html ../dist | |
- name: 🚀 Publish Site | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
folder: dist | |
single-commit: true |