Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix build using flake #162

Merged
merged 11 commits into from
Mar 29, 2022
83 changes: 83 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
name: "Nix Build"
"on": [push, pull_request]
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
nixpkgs:
- pinned
- release-21.11
- release-21.05
- nixpkgs-unstable
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]

- name: Install nix
uses: cachix/install-nix-action@v16
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

- name: Link to bifrost binary cache on cachix.org
uses: cachix/cachix-action@v10
with:
name: bifrost
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Lock the version of nixpkgs specified by the matrix
run: |
if "${{ matrix.nixpkgs }}" != "pinned"; then
nix flake lock --override-input nixpkgs \
"nixpkgs/${{ matrix.nixpkgs }}"
fi
nix flake metadata

- name: Check for well-formed flake
run: |
nix flake check

- name: Build for default python3
run: |
nix build --print-build-logs .#bifrost-py3

- name: Build with enable-debug for python3, if pinned nixpkgs
if: matrix.nixpkgs == 'pinned'
run: |
nix build --print-build-logs .#bifrost-py3-debug

- name: Build for python38, unless nixpkgs-unstable
# For unstable, 3.8 packages are no longer in the build cache
if: matrix.nixpkgs != 'nixpkgs-unstable'
run: |
nix build --print-build-logs .#bifrost-py38

- name: Run Python test suite
# Skipped during nix build because it needs network data.
run: |
cd test
bash download_test_data.sh
nix run ..#python3-bifrost -- -m bifrost.telemetry --disable
nix run ..#python3-bifrost -- -m unittest discover

- name: Build documentation
run: |
nix build --print-build-logs --out-link result-doc .#bifrost-doc

- name: Deploy documentation to gh-pages
uses: JamesIves/[email protected]
# Maybe only deploy if changes in doc/ folder? (But some doc
# pages generated from code, so should reflect code changes?)
if: |
matrix.os == 'ubuntu-latest'
&& matrix.nixpkgs == 'pinned'
&& github.event_name == 'push'
&& github.ref == 'refs/heads/master'
with:
branch: gh-pages
folder: result-doc/share/doc/bifrost/html
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.10.1
* Cleaned up the Makefile outputs
* Added support for configurable, reproducible building with nix

0.10.0
* Switched over to an autotools-based build system
Expand Down
80 changes: 80 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading