Skip to content

chore: Nix & Cachix CI config #171

chore: Nix & Cachix CI config

chore: Nix & Cachix CI config #171

Workflow file for this run

name: Build and test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test-doc:
name: Test & Doc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: novops
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ runner.arch }}-cargo
- uses: actions/cache@v3
with:
path: |
~/.local/share/containers/storage/
key: ${{ runner.os }}-${{ runner.arch }}-podman
- run: nix develop -c make test
# Build doc on the same job to use cache (takes 5s)
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: build mdBook site
run: nix develop -c make doc
- name: Upload mdBook artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./docs/book
image-build:
name: Container image & binary build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: novops
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/cache@v3
with:
path: |
.image-cache
key: ${{ runner.os }}-${{ runner.arch }}-podman
- run: nix develop -c make build-image
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: novops-binary
path: |
build/novops
test-novops-cli:
name: run Novops commands
runs-on: ubuntu-latest
needs: image-build
steps:
- uses: actions/checkout@v3
- name: Download novops artifact
uses: actions/download-artifact@v3
with:
name: novops-binary
- name: novops load
run: |
chmod +x ./novops
./novops load -c tests/.novops.plain-strings.yml -s .envrc -e dev
cat .envrc >> "$GITHUB_ENV"
- name: check novops loaded values
run: env | grep MY_APP_HOST
- name: novops run and check var
run: |
./novops run -c tests/.novops.plain-strings.yml -e dev -- sh -c "env | grep DOG_PATH"
#
# main / releases only
#
doc-deploy:
permissions:
contents: read
pages: write
id-token: write
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build

Check failure on line 126 in .github/workflows/build-test.yml

View workflow run for this annotation

GitHub Actions / Build and test

Invalid workflow file

The workflow is not valid. .github/workflows/build-test.yml (Line: 126, Col: 12): Job 'doc-deploy' depends on unknown job 'build'.
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# name: Publish release artifacts
# on:
# push:
# tags:
# - "v*.*.*"
# build_publish:
# permissions:
# contents: write
# pull-requests: write
# name: Publish
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build
# uses: docker/build-push-action@v4
# with:
# cache-from: type=gha
# cache-to: type=gha,mode=max
# push: true
# tags: |
# crafteo/novops:${{ github.ref_name }}
# crafteo/novops:latest
# - name: Build
# uses: docker/build-push-action@v4
# with:
# cache-from: type=gha
# cache-to: type=gha,mode=max
# outputs: "type=local,dest=novops-build"
# - name: Zip artifact
# uses: montudor/action-zip@v1
# with:
# args: zip -j novops-${{ runner.arch }}-${{ runner.os }}.zip novops-build/novops
# - name: Artifact checksum
# run: sha256sum novops-${{ runner.arch }}-${{ runner.os }}.zip > novops-${{ runner.arch }}-${{ runner.os }}.zip.sha256sum
# - name: Upload Release Artifact
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: >-
# gh release upload $GITHUB_REF_NAME
# novops-$RUNNER_ARCH-$RUNNER_OS.zip
# novops-$RUNNER_ARCH-$RUNNER_OS.zip.sha256sum