Merge pull request #642 from penguincoder/memcached-readiness-check #1304
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 & Test" | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [[ubuntu-latest], [macos-latest], [self-hosted, macOS]] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v21 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: devenv | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- run: | | |
nix profile remove '.*' | |
nix profile install --accept-flake-config . | |
- name: Run tests | |
run: | | |
devenv ci | |
devenv shell devenv-run-tests | |
devenv search ncdu | grep "pkgs\.ncdu" | |
generate-examples: | |
runs-on: ubuntu-latest | |
outputs: | |
examples: ${{ steps.set-examples.outputs.examples }} | |
steps: | |
- name: Checkout base repo | |
uses: actions/checkout@v3 | |
- id: set-examples | |
run: | | |
json=$(tree -J -L 1 examples | jq -c '[.[0].contents[] | .name]') | |
echo "examples=$json" >> $GITHUB_OUTPUT | |
examples: | |
name: example ${{ matrix.example }} (${{ join(matrix.os) }}) | |
needs: [generate-examples] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [[ubuntu-latest], [macos-latest], [self-hosted, macOS]] | |
example: ${{ fromJSON(needs.generate-examples.outputs.examples) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v21 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: devenv | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- run: | | |
nix profile remove '.*' | |
nix profile install --accept-flake-config . "nixpkgs#gawk" | |
- name: Disable package aliases | |
run: | | |
mkdir -p ~/.config/nixpkgs | |
echo '{ allowAliases = false; }' > ~/.config/nixpkgs/config.nix | |
- run: | | |
cd examples/${{ matrix.example }}/ | |
mv devenv.yaml devenv.yaml.orig | |
awk ' | |
{ print } | |
/^inputs:$/ { | |
print " devenv:"; | |
print " url: path:../../src/modules"; | |
} | |
' devenv.yaml.orig > devenv.yaml | |
- run: devenv shell devenv-test-example ${{ matrix.example }} | |
direnv: | |
name: direnv (${{ join(matrix.os) }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [[ubuntu-latest], [macos-latest], [self-hosted, macOS]] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: devenv | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- run: | | |
mv ./examples/simple/devenv.yaml ./examples/simple/devenv.yaml.orig | |
awk ' | |
{ print } | |
/^inputs:$/ { | |
print " devenv:"; | |
print " url: path:../../src/modules"; | |
} | |
' ./examples/simple/devenv.yaml.orig > ./examples/simple/devenv.yaml | |
nix profile remove '.*' | |
nix profile install . 'nixpkgs#direnv' | |
mkdir -p ~/.config/direnv/ | |
cat > ~/.config/direnv/direnv.toml << 'EOF' | |
[global] | |
strict_env = true | |
EOF | |
direnv allow ./examples/simple | |
direnv exec ./examples/simple true | |
fish-zsh: | |
name: zsh/fish (${{ join(matrix.os) }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [[ubuntu-latest], [macos-latest], [self-hosted, macOS]] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: devenv | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- run: | | |
nix profile remove '.*' | |
nix profile install --accept-flake-config . | |
- run: | | |
nix shell nixpkgs#zsh -c zsh -c "$(which devenv) version" | |
nix shell nixpkgs#fish -c fish -c "$(which devenv) version" |