Skip to content

Commit

Permalink
ci: run tests on mac & ubuntu without Nix
Browse files Browse the repository at this point in the history
  • Loading branch information
hraban committed Feb 29, 2024
1 parent b0b8513 commit 0d4698e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
48 changes: 41 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,47 @@ jobs:
-
name: Create artifact bundle
run: |
(cd result/bin && tar cvf $OLDPWD/artifacts.tar tomono)
(cd result/doc && tar rvf $OLDPWD/artifacts.tar index.html style.css)
(cd result/bin && tar cvf $OLDPWD/executables.tar *)
(cd result/doc && tar cvf $OLDPWD/website.tar index.html style.css)
-
if: ${{ github.ref_type == 'branch' && github.ref == 'refs/heads/master' }}
uses: actions/upload-artifact@v3
name: "Upload website artifacts"
with:
name: bundle-${{github.sha}}
path: artifacts.tar
name: website-${{github.sha}}
path: website.tar
-
uses: actions/upload-artifact@v3
name: "Upload binary artifacts"
with:
name: executables-${{github.sha}}
path: binaries.tar

test-nonix:
timeout-minutes: 10
name: "Test stand-alone binary without Nix"
needs: build
strategy:
matrix:
config:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.config }}
steps:
- uses: actions/download-artifact@v3
with:
name: executables-${{github.sha}}
- name: Unpack artifacts
run: |
tar xvf executables.tar index.html style.css
rm -f executables.tar
- name: configure git
run: |
git config user.name "GitHub Actions"
git config user.email "<>"
- name: Run tests
run: |
./tomono-test
deploy_pages:
timeout-minutes: 10
Expand All @@ -64,11 +98,11 @@ jobs:
-
uses: actions/download-artifact@v3
with:
name: bundle-${{github.sha}}
name: website-${{github.sha}}
- name: Unpack artifacts
run: |
tar xvf artifacts.tar index.html style.css
rm -f artifacts.tar
tar xvf website.tar index.html style.css
rm -f website.tar
-
name: configure git
run: |
Expand Down
10 changes: 8 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@
rm -f tomono
${myemacs}/bin/emacs -Q --script ./publish.el
'';
# If you want to put the test program in the final bin
keepTest = false;
installPhase = ''
mkdir -p $out/{bin,doc}
cp tomono $out/bin/
if [[ "$keepTest" -eq 1 ]]; then
cp test $out/bin/tomono-test
fi
cp index.html style.css $out/doc
'';
nativeBuildInputs = [ pkgs.makeWrapper ];
Expand All @@ -47,6 +52,8 @@
# For distribution outside of Nix
dist = self.packages.${system}.default.overrideAttrs (_: {
dontFixup = true;
# This doesn’t make sense but it makes CI easier and who cares.
keepTest = true;
});
};
checks.default =
Expand All @@ -56,8 +63,7 @@
# patching of the main derivation, so I can just immediately call
# it.
tomono-test = self.packages.${system}.default.overrideAttrs (_: {
pname = "tomono-test";
installPhase = "mkdir -p $out/bin; cp test $out/bin/tomono-test";
keepTest = true;
});
in
pkgs.stdenv.mkDerivation (_: {
Expand Down

0 comments on commit 0d4698e

Please sign in to comment.