build(per-system): fix nix build #357
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
on: | |
push: | |
jobs: | |
nix: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: nialov | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}" | |
- name: Check with nix | |
# This also builds documentation (fractopo-documentation) so docs job | |
# does not have to run every time | |
run: | | |
nix run .#nix-fast-build -- --skip-cached --no-nom | |
poetry: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
python-version: ["3.9", "3.10", "3.11"] | |
runs-on: ${{ matrix.platform }} | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: nialov | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}" | |
- name: Test with poetry on Python ${{ matrix.python-version }} | |
run: | | |
nix run .#poetry-run -- ${{ matrix.python-version }} pytest | |
release: | |
runs-on: ubuntu-latest | |
needs: [nix, poetry] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: nialov | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}" | |
- name: Build package with poetry | |
run: | | |
nix develop -c poetry check | |
nix develop -c poetry build | |
- name: Check that version in pyproject.toml is equivalent to tag | |
if: > | |
github.event_name == 'push' | |
&& startsWith(github.ref, 'refs/tags') | |
run: | | |
nix run .#sync-git-tag-with-poetry | |
git diff --exit-code | |
- name: Publish distribution 📦 to PyPI on tagged commit pushes | |
# Publish to PyPI on tagged commit pushes on master | |
if: > | |
github.event_name == 'push' | |
&& startsWith(github.ref, 'refs/tags') | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
- name: Create incremental changelog | |
run: > | |
sed -n '3,/## v[[:digit:]].[[:digit:]].[[:digit:]]/p' CHANGELOG.md | head -n -2 | |
> RELEASE_CHANGELOG.md | |
# sed -n '2,/Release Changelog/p' CHANGELOG.md | head -n -4 | |
- name: Echo RELEASE_CHANGELOG.md | |
run: cat RELEASE_CHANGELOG.md | |
- name: Publish release on GitHub | |
if: > | |
github.event_name == 'push' | |
&& startsWith(github.ref, 'refs/tags') | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: RELEASE_CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docs: | |
if: > | |
github.event_name == 'push' | |
&& startsWith(github.ref, 'refs/heads/master') | |
needs: [nix] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: nialov | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}" | |
- name: Build documentation | |
run: | | |
nix build .#fractopo.passthru.documentation.doc | |
cp -Lr --no-preserve=mode,ownership,timestamps "$(find ./result-doc/ -maxdepth 4 -type 'd' -path '*html*')" ./docs | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload folder with static docs | |
path: "docs/" | |
- uses: actions/configure-pages@v5 | |
- id: deployment | |
uses: actions/deploy-pages@v4 |