on master help sign in
try caching
e7cc929iko
.github/actions/common_setup/action.yaml+6−7
@@ -1,8 +1,8 @@
1name: "Common setup"
1name: "Common setup"
2description: "Common setup steps"
2description: "Common setup steps"
3inputs:
3inputs:
4− cachixSigningKey:
4+ key:
5− description: "Cachix signing key"
5+ description: "Caching key"
6 required: true
6 required: true
7runs:
7runs:
8 using: "composite"
8 using: "composite"
@@ -15,8 +15,7 @@ runs:
15 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
15 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
16 substituters = https://hydra.iohk.io https://cache.nixos.org/
16 substituters = https://hydra.iohk.io https://cache.nixos.org/
17
17
18− # - name: Login to Cachix
18+ - name: Cache Nix
19− # uses: cachix/cachix-action@v10
19+ uses: ./.github/actions/nix_cache
20− # with:
20+ with:
21− # name: octopod
21+ key: ${{ inputs.key }}
22− # signingKey: ${{ inputs.cachixSigningKey }}
.github/actions/nix_cache/action.yamlnew file+25
@@ -0,0 +1,25 @@
1+name: "Nix cache"
2+description: "Cache nix build"
3+inputs:
4+ key:
5+ description: "Caching key"
6+ required: true
7+runs:
8+ using: "composite"
9+ steps:
10+ - name: Cache Nix
11+ id: cache-nix
12+ uses: actions/cache@latest
13+ with:
14+ path: |
15+ ~/nix/store
16+ key: ${{ inputs.key }}
17+ - name: Move nix cache
18+ shell: bash
19+ env:
20+ CACHE_HIT: ${{ steps.cache-nix.outputs.cache-hit }}
21+ run: |
22+ if [[ "$CACHE_HIT" == 'true' ]]; then
23+ sudo mkdir -p $NIX_STORE
24+ sudo mv -f ~/nix/store/* /nix/store/
25+ fi
.github/actions/nix_cache_post/action.yamlnew file+10
@@ -0,0 +1,10 @@
1+name: "Nix cache post"
2+description: "Cache nix build post"
3+runs:
4+ using: "composite"
5+ steps:
6+ - name: Move nix cache
7+ shell: bash
8+ run: |
9+ mkdir -p ~/nix/store
10+ sudo mv -f /nix/store/* ~/nix/store/
.github/actions/push_docker_images/action.yamldeleted−20
@@ -1,20 +0,0 @@
1−name: "Push Docker Images"
2−description: "Push Docker Images"
3−inputs:
4− tag:
5− description: "The docker image tag to push."
6− required: true
7− docker_username:
8− description: "The Docker Hub username"
9− required: true
10− docker_password:
11− description: "The Docker Hub password"
12− required: true
13−runs:
14− using: "composite"
15− steps:
16− - name: Push Docker Images to DockerHub
17− shell: bash
18− run: |
19− skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto) docker://typeable/comparest-github-action:${{ inputs.tag }}
20− skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto) docker://typeable/comparest:${{ inputs.tag }}
.github/workflows/github-actions-image.yaml+16−1
@@ -29,7 +29,9 @@ jobs:
29 submodules: recursive
29 submodules: recursive
30
30
31 - name: Common setup
31 - name: Common setup
32− uses: ./.github/actions/common_setup
32+ uses: ./.github/actions/nix_cache
33+ with:
34+ key: Linux-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**.cabal') }}
33
35
34 - name: Build Linux static binary
36 - name: Build Linux static binary
35 shell: bash
37 shell: bash
@@ -80,6 +82,9 @@ jobs:
80 skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto) docker://typeable/comparest-github-action:${{ github.event.payload.name }}
82 skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto) docker://typeable/comparest-github-action:${{ github.event.payload.name }}
81 skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto) docker://typeable/comparest:${{ github.event.payload.name }}
83 skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto) docker://typeable/comparest:${{ github.event.payload.name }}
82
84
85+ - name: Cache Nix post
86+ uses: ./.github/actions/nix_cache_post
87+
83 macOS:
88 macOS:
84 runs-on: macos-latest
89 runs-on: macos-latest
85 steps:
90 steps:
@@ -89,6 +94,8 @@ jobs:
89
94
90 - name: Common setup
95 - name: Common setup
91 uses: ./.github/actions/common_setup
96 uses: ./.github/actions/common_setup
97+ with:
98+ key: macOS-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**.cabal') }}
92
99
93 - name: Build macOS binary bundle
100 - name: Build macOS binary bundle
94 run: |
101 run: |
@@ -100,6 +107,9 @@ jobs:
100 name: compaREST-macOS
107 name: compaREST-macOS
101 path: compaREST
108 path: compaREST
102
109
110+ - name: Cache Nix post
111+ uses: ./.github/actions/nix_cache_post
112+
103 Linux-Windows:
113 Linux-Windows:
104 runs-on: ubuntu-latest
114 runs-on: ubuntu-latest
105 steps:
115 steps:
@@ -121,6 +131,8 @@ jobs:
121
131
122 - name: Common setup
132 - name: Common setup
123 uses: ./.github/actions/common_setup
133 uses: ./.github/actions/common_setup
134+ with:
135+ key: Linux-Windows-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**.cabal') }}
124
136
125 - name: Build Windows binary
137 - name: Build Windows binary
126 run: |
138 run: |
@@ -137,3 +149,6 @@ jobs:
137 with:
149 with:
138 name: compaREST-Windows
150 name: compaREST-Windows
139 path: compaREST
151 path: compaREST
152+
153+ - name: Cache Nix post
154+ uses: ./.github/actions/nix_cache_post