Merge pull request #14 from bytes-zone/update-nixpkgs #82
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
name: Build and Check | |
on: | |
push: | |
# branches: | |
# - "!main" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
name: build site | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v9 | |
- uses: DeterminateSystems/magic-nix-cache-action@v3 | |
- uses: nixbuild/nixbuild-action@v19 | |
with: | |
nixbuild_token: ${{ secrets.NIXBUILD_TOKEN }} | |
generate_summary_for: 'workflow' | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: 18 | |
# - run: npm install -g @lhci/cli@0.13.x | |
- name: build and load container | |
run: | | |
STORE_PATH="$( | |
nix build \ | |
--json \ | |
--print-build-logs \ | |
--builders "" \ | |
--max-jobs 2 \ | |
--eval-store auto \ | |
--store ssh-ng://eu.nixbuild.net \ | |
--system x86_64-linux \ | |
.#container | \ | |
jq -r '.[0].outputs.out' | |
)" | |
nix copy \ | |
--from ssh-ng://eu.nixbuild.net \ | |
--substitute \ | |
"$STORE_PATH" | |
"$STORE_PATH" | docker load | |
- name: run container and check it listens on :80 | |
run: | | |
export IMAGE="$( | |
docker images --format '{{.Repository}}:{{.Tag}}' | \ | |
grep bytes.zone | \ | |
head -n 1 | |
)" | |
docker run -p 8080:80 -d --name bytes-zone "$IMAGE" | |
for i in $(seq 1 10); do | |
if docker logs bytes-zone | grep 'start worker processes'; then | |
break | |
fi | |
sleep 1 | |
done | |
curl --fail-with-body localhost:8080 | |
# - name: run LHCI | |
# run: | | |
# export IMAGE="$( | |
# docker images --format '{{.Repository}}:{{.Tag}}' | \ | |
# grep bytes.zone | \ | |
# head -n 1 | |
# )" | |
# | |
# lhci autorun |