Skip to content

Commit

Permalink
ci: add job for NixOS
Browse files Browse the repository at this point in the history
  • Loading branch information
edouard-lopez committed Aug 30, 2023
1 parent 529dec5 commit 320f37b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 17 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 1,8 @@
# yamllint disable rule:braces
# yamllint disable rule:indentation
---
name: Run tests on CI
# yamllint disable-line rule:truthy
on:
push:
branches:
Expand All @@ -24,8 28,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version:
[
version: [
{ fish: 3.0.2, alpine: 3.11 },
{ fish: 3.1.2, alpine: 3.13 },
{ fish: 3.2.2, alpine: 3.14 },
Expand All @@ -41,6 44,21 @@ jobs:
- run: docker --version
- run: make test-pure-on FISH_VERSION=${{ matrix.version.fish }}

test-nixos:
name: Test `pure` with Fish ${{ matrix.version.fish }} on NixOS container
runs-on: ubuntu-latest
strategy:
matrix:
version: [
{ fish: 3.6.1, alpine: 3.18 },
# { fish: 3.6.2, alpine: 'edge' },
]
steps:
- uses: actions/checkout@v2
- run: make build-pure-on-nix FISH_VERSION=${{ matrix.version.fish }}
- run: docker --version
- run: make test-pure-on-nix FISH_VERSION=${{ matrix.version.fish }}

# test-macos:
# name: Test on fish on MacOS
# runs-on: macos-latest
Expand Down
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions nix.Dockerfile → docker/nix.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 14,23 @@ RUN fish --version
# hadolint ignore=DL3059,SC1008
RUN nix-build '<nixpkgs>' -A fishPlugins.pure \
&& nix-env -iA \
nixpkgs.vim \
nixpkgs.diffutils \
nixpkgs.curlMinimal \
nixpkgs.gnused \
nixpkgs.gawk \
nixpkgs.fishPlugins.fishtape_3
nixpkgs.vim \
nixpkgs.diffutils \
nixpkgs.curlMinimal \
nixpkgs.gnused \
nixpkgs.gawk \
nixpkgs.fishPlugins.fishtape_3
# hadolint ignore=SC1008
COPY configuration.nix /etc/nixos/configuration.nix
COPY ./docker/configuration.nix /etc/nixos/configuration.nix
# hadolint ignore=SC1008
RUN mkdir -p /root/.config/fish/functions/ \
&& cp \
/nix/store/*-user-environment/share/fish/vendor_functions.d/fishtape.fish \
/root/.config/fish/functions/
/nix/store/*-user-environment/share/fish/vendor_functions.d/fishtape.fish \
/root/.config/fish/functions/
# hadolint ignore=SC1008
RUN nix build \
github:NixOS/nixpkgs/6573f71#fishPlugins.pure \
--print-build-logs \
github:NixOS/nixpkgs/6573f71#fishPlugins.pure \
--print-build-logs \
|| true

WORKDIR /tmp/.pure
Expand Down
32 changes: 29 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 18,7 @@ build-pure-on: STAGE?=only-fish
build-pure-on:
docker build \
--quiet \
--file ./Dockerfile \
--file ./docker/Dockerfile \
--target ${STAGE} \
--build-arg FISH_VERSION=${FISH_VERSION} \
--tag=pure-${STAGE}-${FISH_VERSION} \
Expand All @@ -30,7 30,7 @@ dev-pure-on: STAGE?=with-pure-source
dev-pure-on:
chmod o=rwx tests/fixtures/ # for migration-to-4.0.0.test.fish only
docker run \
--name run-pure-on-${FISH_VERSION} \
--name dev-pure-on-${FISH_VERSION} \
--rm \
--interactive \
--tty \
Expand All @@ -44,7 44,7 @@ test-pure-on: CMD?=fishtape tests/*.test.fish
test-pure-on: STAGE?=with-pure-source
test-pure-on: build-with-pure-source
docker run \
--name run-pure-on-${FISH_VERSION} \
--name test-pure-on-${FISH_VERSION} \
--rm \
--tty \
pure-${STAGE}-${FISH_VERSION} "${CMD}"
Expand All @@ -59,3 59,29 @@ dev-with-pure-installed:
$(MAKE) dev-pure-on FISH_VERSION=${FISH_VERSION} STAGE=with-pure-installed


build-pure-on-nix: STAGE?=nix
build-pure-on-nix:
docker build \
--file ./docker/${STAGE}.Dockerfile \
--build-arg FISH_VERSION=${FISH_VERSION} \
--tag=pure-${STAGE}-${FISH_VERSION} \
./

dev-pure-on-nix: STAGE?=nix
dev-pure-on-nix: CMD?=fish
dev-pure-on-nix:
echo ${CMD} ${STAGE}
chmod o=rwx ./tests/fixtures/ # for migration-to-4.0.0.test.fish only
docker run \
--name dev-pure-on-${FISH_VERSION} \
--rm \
--interactive \
--tty \
--volume=$$(pwd):/tmp/.pure/ \
--workdir /tmp/.pure/ \
pure-${STAGE}-${FISH_VERSION} "${CMD}"
chmod o=r-x ./tests/fixtures/ # for migration-to-4.0.0.test.fish only

test-pure-on-nix: CMD?=fishtape tests/*.test.fish
test-pure-on-nix:
$(MAKE) dev-pure-on-nix CMD="${CMD}"
2 changes: 1 addition & 1 deletion notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,7 @@ docker run \
--tty \
--rm \
--volume=(pwd):/tmp/.pure/ \
pure-on-nix
pure-on-nix
fish
```

Expand Down

0 comments on commit 320f37b

Please sign in to comment.