test: ensure git author config in tests #126
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: "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 and Test" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@v9 | |
- name: Configure Nix cache | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
- | |
name: Tangle code and export HTML | |
run: "nix build .#dist" | |
- | |
name: "Test: integration test" | |
run: nix flake check | |
- | |
name: "Test: vendored script equals build" | |
run: diff -u ./tomono result/bin/tomono | |
- | |
name: Create artifact bundle | |
run: | | |
(cd result/bin && tar cvf $OLDPWD/executables.tar *) | |
(cd result/doc && tar cvf $OLDPWD/website.tar index.html style.css) | |
- | |
uses: actions/upload-artifact@v4 | |
name: "Upload website artifacts" | |
with: | |
name: website-${{github.sha}} | |
path: website.tar | |
- | |
uses: actions/upload-artifact@v4 | |
name: "Upload binary artifacts" | |
with: | |
name: executables-${{github.sha}} | |
path: executables.tar | |
test-nonix: | |
timeout-minutes: 10 | |
name: "Test stand-alone binary without Nix" | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- ubuntu-latest | |
- macos-latest | |
runs-on: ${{ matrix.config }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: executables-${{github.sha}} | |
- name: Unpack artifacts | |
run: | | |
tar xvf executables.tar | |
rm -f executables.tar | |
- name: configure git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "<>" | |
- name: Run tests | |
run: | | |
./tomono-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@v4 | |
with: | |
ref: gh-pages | |
- | |
uses: actions/download-artifact@v4 | |
with: | |
name: website-${{github.sha}} | |
- name: Unpack artifacts | |
run: | | |
tar xvf website.tar | |
rm -f website.tar | |
- | |
name: configure git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global 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 |