Merge pull request #45 from cachix/ignore-garbage-collected

Ignore garbage collected
This commit is contained in:
Domen Kožar 2020-05-12 11:21:10 +02:00 committed by GitHub
commit 0a765b01e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 21 deletions

View file

@ -4,45 +4,53 @@ on:
push:
jobs:
tests:
public-cache:
strategy:
matrix:
os: [ubuntu-18.04, macos]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- uses: cachix/install-nix-action@v8
- name: Test public cache
uses: ./
with:
name: cachix-action
file: test.nix
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build test.nix
public-cache-no-signing-key:
strategy:
matrix:
os: [ubuntu-18.04, macos]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: yarn install --frozen-lockfile
- run: yarn build
- uses: cachix/install-nix-action@v8
- name: Test public cache no signing key
uses: ./
with:
name: cachix-action
file: test.nix
signingKey: ''
- name: Test public cache no pushing
uses: ./
with:
name: cachix-action
skipNixBuild: true
- name: Test nixBuildArgs parameter
uses: ./
with:
name: cachix-action
file: test-with-arg.nix
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
nixBuildArgs: --argstr arg foobar
- run: nix-build test.nix
private-cache:
strategy:
matrix:
os: [ubuntu-18.04, macos]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: yarn install --frozen-lockfile
- run: yarn build
- uses: cachix/install-nix-action@v8
- name: Test private cache
uses: ./
with:
name: cachix-action-private
file: test.nix
signingKey: '${{ secrets.CACHIX_SIGNING_KEY_PRIVATE }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-build test.nix

3
dist/main/index.js vendored
View file

@ -971,6 +971,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const child_process_1 = __webpack_require__(129);
const coreCommand = __importStar(__webpack_require__(431));
const exec = __importStar(__webpack_require__(986));
exports.IsPost = !!process.env['STATE_isPost'];
@ -1010,7 +1011,7 @@ function upload() {
try {
if (signingKey !== "" && skipPush !== 'true') {
core.startGroup('Cachix: pushing paths');
yield exec.exec("sh", ["-c", `nix path-info --all | grep -v '\.drv$' | cat - /tmp/store-path-pre-build | sort | uniq -u | ${cachixExecutable} push ${name}`]);
child_process_1.execFileSync(`${__dirname}/push-paths.sh`, { stdio: 'inherit' });
core.endGroup();
}
}

4
dist/main/push-paths.sh vendored Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
comm -13 <(sort /tmp/store-path-pre-build) <(nix path-info --all | grep -v '\.drv$' | sort) | $1 push -j8 $2

View file

@ -1,4 +1,5 @@
import * as core from '@actions/core';
import { execFileSync } from 'child_process';
import * as coreCommand from '@actions/core/lib/command'
import * as exec from '@actions/exec';
@ -41,7 +42,7 @@ async function upload() {
try {
if (signingKey !== "" && skipPush !== 'true') {
core.startGroup('Cachix: pushing paths');
await exec.exec("sh", ["-c", `nix path-info --all | grep -v '\.drv$' | cat - /tmp/store-path-pre-build | sort | uniq -u | ${cachixExecutable} push ${name}`]);
execFileSync(`${__dirname}/push-paths.sh`, [cachixExecutable, name], { stdio: 'inherit' });
core.endGroup();
}
} catch (error) {