generated from srid/rib-sample
-
-
Notifications
You must be signed in to change notification settings - Fork 150
49 lines (49 loc) · 1.71 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: "CI"
on:
pull_request:
push:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
MAINLINE: refs/heads/master
DOCKERTAG: latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v16
with:
extra_nix_config: |
experimental-features = nix-command flakes
# This also runs nix-build.
- uses: cachix/cachix-action@v10
with:
name: srid
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
# Only needed for private caches
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
# This downloads deps from Nix cache, builds neuron, as well as run tests
- name: Build 🔧
run: |
nix-build -j4 --no-out-link ci.nix
# Test default.nix
nix-build -j4
# Test flake.nix
nix build --out-link flake-result
- name: Verify output of default.nix & flake.nix
run: |
[ $(readlink result) = $(readlink flake-result) ]
- name: Retrieve neuron version
run: |
echo "NEURONVER=$(./result/bin/neuron --version)" >> $GITHUB_ENV
- name: Publish Docker image to Docker Hub
if: ${{ github.ref == env.MAINLINE && runner.os == 'Linux' }}
run: |
docker load -i $(nix-build docker.nix --argstr tag "${{ env.DOCKERTAG }}")
docker tag "sridca/neuron:${{ env.DOCKERTAG }}" "sridca/neuron:${{env.NEURONVER}}"
echo ${{ secrets.DOCKER_PASS }} | docker login -u sridca --password-stdin
set -x
docker push "sridca/neuron:${{ env.DOCKERTAG }}"
docker push "sridca/neuron:${{ env.NEURONVER }}"