Compare commits

...

11 Commits

Author SHA1 Message Date
06b877d930 v4 2019-11-13 17:00:55 +01:00
d1407282e6 Merge pull request #9 from cachix/catalina
Catalina
2019-11-13 16:52:08 +01:00
9130accbad try out catalina fix 2019-11-13 16:47:37 +01:00
9c08345130 add shell.nix for easier development 2019-11-07 10:19:07 +01:00
4ad20b153f Fix Catalina 2019-11-07 10:18:56 +01:00
65ed8d8b59 README: bump 2019-10-03 17:40:55 +02:00
e3eb20c3db README: hint to action options 2019-10-03 17:27:13 +02:00
2b219c86f3 Merge pull request #8 from cachix/5-max-jobs
fix #5: set max-jobs = auto
2019-10-03 17:26:22 +02:00
ba979b5e7d fix #5: set max-jobs = auto 2019-10-03 17:23:24 +02:00
67bd092214 bump 2019-10-02 17:38:16 +02:00
f104d5a8aa Merge pull request #4 from cachix/fix-build-check
test that build produces no diff
2019-10-02 16:49:24 +02:00
6 changed files with 39 additions and 7 deletions

View File

@ -6,7 +6,7 @@ jobs:
tests: tests:
strategy: strategy:
matrix: matrix:
os: [ubuntu-18.04, macos] os: [ubuntu-18.04, macos-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1

1
.gitignore vendored
View File

@ -1,7 +1,6 @@
__tests__/runner/* __tests__/runner/*
# comment out in distribution branches # comment out in distribution branches
node_modules/
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs # Logs

View File

@ -18,10 +18,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: cachix/install-nix-action@v1 - uses: cachix/install-nix-action@v3
- run: nix-build - run: nix-build
``` ```
See [action.yml](action.yml) for all options.
See also [cachix-action](https://github.com/cachix/cachix-action) for See also [cachix-action](https://github.com/cachix/cachix-action) for
simple binary cache setup to speed up your builds and share binaries simple binary cache setup to speed up your builds and share binaries
with developers. with developers.

View File

@ -27,10 +27,20 @@ function run() {
const home = os_1.homedir(); const home = os_1.homedir();
const { username } = os_1.userInfo(); const { username } = os_1.userInfo();
const PATH = process.env.PATH; const PATH = process.env.PATH;
const INSTALL_PATH = '/opt/nix';
const CERTS_PATH = home + '/.nix-profile/etc/ssl/certs/ca-bundle.crt'; const CERTS_PATH = home + '/.nix-profile/etc/ssl/certs/ca-bundle.crt';
// Workaround a segfault: https://github.com/NixOS/nix/issues/2733 // Workaround a segfault: https://github.com/NixOS/nix/issues/2733
yield exec.exec("sudo", ["mkdir", "-p", "/etc/nix"]); yield exec.exec("sudo", ["mkdir", "-p", "/etc/nix"]);
yield exec.exec("sudo", ["echo", "http2 = false", ">>", "/etc/nix/nix.conf"]); yield exec.exec("sudo", ["sh", "-c", "echo http2 = false >> /etc/nix/nix.conf"]);
// Set jobs to number of cores
yield exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
// Catalina workaround https://github.com/NixOS/nix/issues/2925
if (os_1.type() == "Darwin") {
yield exec.exec("sudo", ["sh", "-c", `echo \"nix\t${INSTALL_PATH}\" >> /etc/synthetic.conf`]);
yield exec.exec("sudo", ["sh", "-c", `mkdir -m 0755 ${INSTALL_PATH} && chown runner ${INSTALL_PATH}`]);
yield exec.exec("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util", ["-B"]);
core.exportVariable('NIX_IGNORE_SYMLINK_STORE', "1");
}
// TODO: retry due to all the things that go wrong // TODO: retry due to all the things that go wrong
const nixInstall = yield tc.downloadTool('https://nixos.org/nix/install'); const nixInstall = yield tc.downloadTool('https://nixos.org/nix/install');
yield exec.exec("sh", [nixInstall]); yield exec.exec("sh", [nixInstall]);

8
shell.nix Normal file
View File

@ -0,0 +1,8 @@
{ pkgs ? import <nixpkgs> {}
}:
pkgs.mkShell {
name = "install-nix-action-shell";
buildInputs = [ pkgs.yarn ];
}

View File

@ -1,7 +1,7 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as exec from '@actions/exec'; import * as exec from '@actions/exec';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import {homedir, userInfo} from 'os'; import {homedir, userInfo, type} from 'os';
import {existsSync} from 'fs'; import {existsSync} from 'fs';
async function run() { async function run() {
@ -9,11 +9,23 @@ async function run() {
const home = homedir(); const home = homedir();
const {username} = userInfo(); const {username} = userInfo();
const PATH = process.env.PATH; const PATH = process.env.PATH;
const INSTALL_PATH = '/opt/nix';
const CERTS_PATH = home + '/.nix-profile/etc/ssl/certs/ca-bundle.crt'; const CERTS_PATH = home + '/.nix-profile/etc/ssl/certs/ca-bundle.crt';
// Workaround a segfault: https://github.com/NixOS/nix/issues/2733 // Workaround a segfault: https://github.com/NixOS/nix/issues/2733
await exec.exec("sudo", ["mkdir", "-p", "/etc/nix"]); await exec.exec("sudo", ["mkdir", "-p", "/etc/nix"]);
await exec.exec("sudo", ["echo", "http2 = false", ">>", "/etc/nix/nix.conf"]); await exec.exec("sudo", ["sh", "-c", "echo http2 = false >> /etc/nix/nix.conf"]);
// Set jobs to number of cores
await exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
// Catalina workaround https://github.com/NixOS/nix/issues/2925
if (type() == "Darwin") {
await exec.exec("sudo", ["sh", "-c", `echo \"nix\t${INSTALL_PATH}\" >> /etc/synthetic.conf`]);
await exec.exec("sudo", ["sh", "-c", `mkdir -m 0755 ${INSTALL_PATH} && chown runner ${INSTALL_PATH}`]);
await exec.exec("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util", ["-B"]);
core.exportVariable('NIX_IGNORE_SYMLINK_STORE', "1");
}
// TODO: retry due to all the things that go wrong // TODO: retry due to all the things that go wrong
const nixInstall = await tc.downloadTool('https://nixos.org/nix/install'); const nixInstall = await tc.downloadTool('https://nixos.org/nix/install');