on master help sign in
Give up and use cachix
5b6f93biko
.github/actions/common_setup/action.yaml+30−9
@@ -1,15 +1,37 @@
1name: "Common setup"
1name: "Common setup"
2description: "Common setup steps"
2description: "Common setup steps"
3inputs:
3inputs:
4− key:
4+ authToken:
5− description: "Caching key"
5+ description: "Cachix auth token"
6 required: true
6 required: true
7− restore-keys:
8− description: "Restore keys"
9− required: false
10runs:
7runs:
11 using: "composite"
8 using: "composite"
12 steps:
9 steps:
10+ - name: Increase swap if linux
11+ shell: bash
12+ run: |
13+ if [ "$RUNNER_OS" == "Linux" ]; then
14+
15+ echo "Is Linux"
16+
17+ free -h
18+
19+ sudo swapoff /mnt/swapfile
20+ sudo fallocate -l 12G /mnt/swapfile
21+ sudo mkswap /mnt/swapfile
22+ sudo swapon /mnt/swapfile
23+
24+ free -h
25+
26+ else
27+
28+ echo "Not Linux"
29+
30+ fi
31+
32+ - uses: actions/checkout@v2
33+ with:
34+ submodules: recursive
13 - name: Install Nix
35 - name: Install Nix
14 uses: cachix/install-nix-action@v16
36 uses: cachix/install-nix-action@v16
15 with:
37 with:
@@ -17,8 +39,7 @@ runs:
17 system-features = kvm
39 system-features = kvm
18 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
40 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
19 substituters = https://hydra.iohk.io https://cache.nixos.org/
41 substituters = https://hydra.iohk.io https://cache.nixos.org/
20− - name: Cache Nix
42+ - uses: cachix/cachix-action@v10
21− uses: ./.github/actions/nix_cache
22 with:
43 with:
23− key: ${{ inputs.key }}
44+ name: typeable
24− restore-keys: ${{ inputs.restore-keys }}
45+ authToken: "${{ inputs.authToken }}"
.github/actions/nix_cache/action.yamldeleted−47
@@ -1,47 +0,0 @@
1−name: "Nix cache"
2−description: "Cache nix build"
3−inputs:
4− key:
5− description: "Caching key"
6− required: true
7− restore-keys:
8− description: "Restore keys"
9− required: false
10− default: ""
11−runs:
12− using: "composite"
13− steps:
14− # - name: Install Nix
15− # uses: cachix/install-nix-action@v16
16− # with:
17− # extra_nix_config: |
18− # system-features = kvm
19− # trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
20− # substituters = https://hydra.iohk.io https://cache.nixos.org/
21− - name: Install Nix
22− uses: cachix/install-nix-action@v16
23− with:
24− extra_nix_config: |
25− system-features = kvm
26− trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
27− substituters = https://hydra.iohk.io https://cache.nixos.org/
28− - name: Cache Nix
29− id: cache-nix
30− uses: actions/cache@v2.1.7
31− with:
32− path: |
33− ~/nix/store/
34− ~/nix/var/nix/db/db.sqlite
35− key: ${{ inputs.key }}
36− restore-keys: ${{ inputs.restore-keys }}
37− - name: make nix store writable
38− shell: bash
39− run: |
40− ls ~
41− echo
42− if [[ -d ~/nix ]]; then
43− echo "in"
44− ls ~/nix
45− sudo mv -f ~/nix/store /nix/store
46− sudo mv -f ~/nix/var/nix/db/db.sqlite /nix/var/nix/db/db.sqlite
47− fi
.github/actions/nix_cache_post/action.yamldeleted−11
@@ -1,11 +0,0 @@
1−name: "Nix cache post"
2−description: "Cache nix build post"
3−runs:
4− using: "composite"
5− steps:
6− - name: Move nix store
7− shell: bash
8− run: |
9− mkdir -p ~/nix ~/nix/var/nix/db/
10− mv -f /nix/store ~/nix/store
11− sudo mv -f /nix/var/nix/db/db.sqlite ~/nix/var/nix/db/db.sqlite
.github/workflows/github-actions-image.yaml+4−60
@@ -12,30 +12,11 @@ jobs:
12 Linux:
12 Linux:
13 runs-on: ubuntu-latest
13 runs-on: ubuntu-latest
14 steps:
14 steps:
15− - name: Increase swap
16− shell: bash
17− run: |
18− free -h
19−
20− sudo swapoff /mnt/swapfile
21− sudo fallocate -l 12G /mnt/swapfile
22− sudo mkswap /mnt/swapfile
23− sudo swapon /mnt/swapfile
24−
25− free -h
26−
27− - uses: actions/checkout@v2
28− with:
29− submodules: recursive
30−
31 - name: Common setup
15 - name: Common setup
32 uses: ./.github/actions/common_setup
16 uses: ./.github/actions/common_setup
33 with:
17 with:
34− key: Linux-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**.cabal') }}
18+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
35− restore-keys: |
19+
36− Linux-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}
37− Linux-${{ hashFiles('**.nix') }}
38− Linux
39 - name: Build Linux static binary
20 - name: Build Linux static binary
40 shell: bash
21 shell: bash
41 run: |
22 run: |
@@ -113,24 +94,13 @@ jobs:
113 asset_name: compaREST binary – Linux – x86
94 asset_name: compaREST binary – Linux – x86
114 tag: ${{ github.ref }}
95 tag: ${{ github.ref }}
115
96
116− - name: Cahce post
117− uses: ./.github/actions/nix_cache_post
118−
119 macOS:
97 macOS:
120 runs-on: macos-latest
98 runs-on: macos-latest
121 steps:
99 steps:
122− - uses: actions/checkout@v2
123− with:
124− submodules: recursive
125−
126 - name: Common setup
100 - name: Common setup
127 uses: ./.github/actions/common_setup
101 uses: ./.github/actions/common_setup
128 with:
102 with:
129− key: macOS-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**.cabal') }}
103+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
130− restore-keys: |
131− macOS-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}
132− macOS-${{ hashFiles('**.nix') }}
133− macOS
134
104
135 - name: Build macOS binary bundle
105 - name: Build macOS binary bundle
136 run: |
106 run: |
@@ -151,36 +121,13 @@ jobs:
151 asset_name: compaREST binary – macOS – x86
121 asset_name: compaREST binary – macOS – x86
152 tag: ${{ github.ref }}
122 tag: ${{ github.ref }}
153
123
154− - name: Cahce post
155− uses: ./.github/actions/nix_cache_post
156−
157 Linux-Windows:
124 Linux-Windows:
158 runs-on: ubuntu-latest
125 runs-on: ubuntu-latest
159 steps:
126 steps:
160− - name: Increase swap
161− shell: bash
162− run: |
163− free -h
164−
165− sudo swapoff /mnt/swapfile
166− sudo fallocate -l 12G /mnt/swapfile
167− sudo mkswap /mnt/swapfile
168− sudo swapon /mnt/swapfile
169−
170− free -h
171−
172− - uses: actions/checkout@v2
173− with:
174− submodules: recursive
175−
176 - name: Common setup
127 - name: Common setup
177 uses: ./.github/actions/common_setup
128 uses: ./.github/actions/common_setup
178 with:
129 with:
179− key: Linux-Windows-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**.cabal') }}
130+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
180− restore-keys: |
181− Linux-Windows-${{ hashFiles('**.nix') }}-${{ hashFiles('stack.yaml') }}
182− Linux-Windows-${{ hashFiles('**.nix') }}
183− Linux-Windows
184
131
185 - name: Build Windows binary
132 - name: Build Windows binary
186 run: |
133 run: |
@@ -200,6 +147,3 @@ jobs:
200 file: compaREST
147 file: compaREST
201 asset_name: compaREST binary – Windows
148 asset_name: compaREST binary – Windows
202 tag: ${{ github.ref }}
149 tag: ${{ github.ref }}
203−
204− - name: Cahce post
205− uses: ./.github/actions/nix_cache_post