Skip to content

build: nix (flake) support #61

build: nix (flake) support

build: nix (flake) support #61

Workflow file for this run

name: "CI/CD"
"on":
pull_request: {}
push:
branches: ["**"]
tags: ["**"]
env:
DOCKER_BUILDKIT: 1
defaults:
run:
# For the windows phase
shell: bash
jobs:
build:
timeout-minutes: 10
name: "Build: compile source code and export HTML"
runs-on: ubuntu-latest
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Checkout
uses: actions/checkout@v2
- # This is very wasteful but caching docker images on GH actions is
# INSANELY DIFFICULT!!! Honestly they bring it on themselves, this is
# not an abstruse setup. But until I can cache docker images (let alone
# layers), without pollution between branches / PRs, and without
# 1873907182301273 lines of code, config and separate auths and external
# services, I’ll just stick to rebuilding the entire image every time.
name: Build the Docker image
run: docker-compose build
-
name: Tangle code and export HTML
run: docker-compose run --rm build
-
name: Create artifact bundle
run: tar cvf artifacts.tar test tomono index.html style.css
-
uses: actions/upload-artifact@v3
with:
name: bundle-${{github.sha}}
path: artifacts.tar
test:
timeout-minutes: 10
name: "Test"
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: build
steps:
-
name: Remove files before artifact download
run: rm -rf artifacts.tar
-
uses: actions/download-artifact@v3
with:
name: bundle-${{github.sha}}
-
name: Unpack artifacts
run: tar xvf artifacts.tar
-
name: Set up git for CI
run: |
git config --global user.name CI
git config --global user.email c@i
git config --global init.defaultBranch master
git config --global core.autocrlf input
-
name: Run tests
run: ./test
deploy_pages:
timeout-minutes: 10
if: ${{ github.ref_type == 'branch' && github.ref == 'refs/heads/master' }}
name: "Deploy the HTML to GitHub Pages"
runs-on: ubuntu-latest
needs: build
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
ref: gh-pages
- name: Remove files before artifact download
run: rm -f artifacts.tar
-
uses: actions/download-artifact@v3
with:
name: bundle-${{github.sha}}
- name: Unpack artifacts
run: |
tar xvf artifacts.tar index.html style.css
rm -f artifacts.tar
-
name: configure git
run: |
git config user.name "GitHub Actions"
git config user.email "<>"
-
name: "Commit the HTML to gh-pages branch"
run: |
git add -A
git commit -m "Update gh-pages from ${{github.ref}} @ ${{github.sha}}"
git push origin gh-pages