diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index c4f714183b..90f25ab371 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -14,8 +14,10 @@ defaults: shell: bash # do we really want nixos-unstable? -env: +env: NIX_PATH: "nixpkgs=channel:nixos-unstable" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.number }} jobs: nix-build: @@ -246,3 +248,10 @@ jobs: steps: - uses: actions/checkout@v3 - run: nix build ./nix-tools#checks.x86_64-linux.truncate-index --accept-flake-config + + nixprof: + runs-on: [self-hosted, linux] + steps: + - uses: actions/checkout@v3 + - name: "Run tests with ghc8107: Profile flakes development shell ..." + run: nix shell github:Kha/nixprof -c ./test/tests.sh ghc8107 nixprof diff --git a/test/tests.sh b/test/tests.sh index e7aff800ae..4d5ad44270 100755 --- a/test/tests.sh +++ b/test/tests.sh @@ -228,4 +228,26 @@ if [ "$TESTS" == "docs" ] || [ "$TESTS" == "all" ]; then popd fi +if [ "$TESTS" == "nixprof" ]; then + printf "*** Profile flakes development shell ...\n" >& 2 + cat > Dockerfile <> /etc/nix/nix.conf +RUN nix profile install github:Kha/nixprof +RUN nix profile install nixpkgs#time +WORKDIR /workspace +CMD ["sh", "-c", "nixprof record nix develop --accept-flake-config"] +EOF + docker build -t nixprof . + docker run --mount type=bind,source="$(pwd)/..",target=/workspace nixprof + pushd .. + nixprof report -p + nixprof report -a + nixprof report -s + popd + # FIXME: is that the right way to publish a report on GitHub? + # curl -s -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"body\": \"$report\"}" "https://api.github.com/repos/input-output-hk/haskell.nix/issues/$PR_NUMBER/comments" +fi + printf "\n*** Finished successfully\n" >& 2