chore: Nix & Cachix CI config #164
Workflow file for this run
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 test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
cargo_test: | |
name: Cargo tests | |
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 | |
- run: nix develop -c make test | |
docker_build: | |
name: Docker 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 }}' | |
# Podman uses Buildah and cache is kept under $TMPDIR/buildah-cache | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
$TMPDIR/buildah-cache | |
key: ${{ runner.os }}-${{ runner.arch }}-cargo | |
- run: env | grep TMP | |
- run: nix develop -c make build-image | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: novops-binary | |
path: | | |
novops-build/novops | |
load_novops: | |
name: run Novops commands | |
runs-on: ubuntu-latest | |
needs: docker_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" |