Compare commits

..

20 Commits
fix-97 ... act

Author SHA1 Message Date
76f9967600 try fixing act 2021-11-19 04:31:14 -06:00
7a6ac48c9d Update .github/workflows/test.yml
Co-authored-by: Ryan <me@hackerc.at>
2021-11-17 20:29:05 -06:00
31bbb1e1e8 Update .github/workflows/test.yml
Co-authored-by: Ryan <me@hackerc.at>
2021-11-17 20:29:05 -06:00
9489b6bd0b Update .github/workflows/test.yml
Co-authored-by: Ryan <me@hackerc.at>
2021-11-17 20:29:05 -06:00
ac899278cf Update .github/workflows/test.yml
Co-authored-by: Ryan <me@hackerc.at>
2021-11-17 20:29:05 -06:00
c5e83e525e Update .github/workflows/test.yml
Co-authored-by: Ryan <me@hackerc.at>
2021-11-17 20:29:05 -06:00
5315c85e43 Test for act 2021-11-17 20:29:05 -06:00
d045d9f5d8 Merge pull request #115 from zimbatm/bash-cleanup
Bash cleanup
2021-11-17 20:21:23 -06:00
46187b354d README: flakes don't need the special installer anymore
Fix #114
2021-11-17 20:15:44 -06:00
802bde54e0 install-nix.sh: retry curl 5 times
If fetching the install script fails, don't keep the CI running forever.
2021-11-17 23:11:40 +01:00
21a5164e12 install-nix.sh: fix shellcheck issues 2021-11-17 23:09:47 +01:00
732b0240d2 install-nix.sh: remove unnecessary chmod
The script is invoked with sh and therefor doesn't need and executable
script.
2021-11-17 23:09:47 +01:00
06a240d7b6 install-nix.sh: use a temporary workdir
Don't leave temporary files around
2021-11-17 23:09:47 +01:00
1b5d414ec3 Merge pull request #112 from DavHau/patch-1
fix actions/checkout version in readme.md
2021-11-17 00:39:36 -06:00
b72fecc86e fix actions/checkout version in readme.md
version 2.5.0 doesn't seem to exist
2021-11-17 12:39:48 +07:00
ef6c38c42b bump actions 2021-11-12 08:48:37 -06:00
5f45af07a1 cleanup 2021-11-12 08:41:39 -06:00
489b4a2f78 Merge pull request #105 from cachix/resilient-install
Resilient installation
2021-11-11 16:25:04 -06:00
b93cdea694 Merge pull request #109 from cachix/fix-97
fix #97: install nix config correctly for single-user- mode
2021-11-11 16:19:39 -06:00
783053eda6 Resilient installation 2021-11-11 16:19:02 -06:00
5 changed files with 44 additions and 28 deletions

View File

@ -109,3 +109,17 @@ jobs:
nix_path: nixpkgs=channel:nixos-21.05 nix_path: nixpkgs=channel:nixos-21.05
install_url: https://releases.nixos.org/nix/nix-2.3.5/install install_url: https://releases.nixos.org/nix/nix-2.3.5/install
- run: nix-build test.nix - run: nix-build test.nix
act-support:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.4.0
- uses: actions/setup-go@v2.1.4
with:
go-version: '^1.16'
- run: go install github.com/nektos/act@master
- run: docker pull ghcr.io/catthehacker/ubuntu:js-20.04
- run: ~/go/bin/act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:js-20.04 push -j simple-build

View File

@ -33,8 +33,8 @@ jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v14.1 - uses: cachix/install-nix-action@v15
with: with:
nix_path: nixpkgs=channel:nixos-unstable nix_path: nixpkgs=channel:nixos-unstable
- run: nix-build - run: nix-build
@ -52,11 +52,9 @@ jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v14.1 - uses: cachix/install-nix-action@v15
with: with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: | extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: nix build - run: nix build

View File

@ -1,4 +0,0 @@
test('nothing', async() => {
});
// TODO: hopefully github actions will support integration tests

View File

@ -1,11 +0,0 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}

View File

@ -6,9 +6,13 @@ if type -p nix &>/dev/null ; then
exit exit
fi fi
# Create a temporary workdir
workdir=$(mktemp -d)
trap 'rm -rf "$workdir"' EXIT
# Configure Nix # Configure Nix
add_config() { add_config() {
echo "$1" | tee -a /tmp/nix.conf >/dev/null echo "$1" | tee -a "$workdir/nix.conf" >/dev/null
} }
# Set jobs to number of cores # Set jobs to number of cores
add_config "max-jobs = auto" add_config "max-jobs = auto"
@ -18,7 +22,7 @@ add_config "trusted-users = root $USER"
if [[ $INPUT_EXTRA_NIX_CONFIG != "" ]]; then if [[ $INPUT_EXTRA_NIX_CONFIG != "" ]]; then
add_config "$INPUT_EXTRA_NIX_CONFIG" add_config "$INPUT_EXTRA_NIX_CONFIG"
fi fi
if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "experimental-features" ]]; then if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "experimental-features" ]]; then
add_config "experimental-features = nix-command flakes" add_config "experimental-features = nix-command flakes"
fi fi
@ -26,28 +30,43 @@ fi
installer_options=( installer_options=(
--no-channel-add --no-channel-add
--darwin-use-unencrypted-nix-store-volume --darwin-use-unencrypted-nix-store-volume
--nix-extra-conf-file /tmp/nix.conf --nix-extra-conf-file "$workdir/nix.conf"
) )
# only use the nix-daemon settings if on darwin (which get ignored) or systemd is supported # only use the nix-daemon settings if on darwin (which get ignored) or systemd is supported
if [[ $OSTYPE =~ darwin || -e /run/systemd/system ]]; then if [[ $OSTYPE =~ darwin || -e /run/systemd/system ]]; then
installer_options+=( installer_options+=(
--daemon --daemon
--daemon-user-count `python -c 'import multiprocessing as mp; print(mp.cpu_count() * 2)'` --daemon-user-count "$(python -c 'import multiprocessing as mp; print(mp.cpu_count() * 2)')"
) )
else else
# "fix" the following error when running nix* # "fix" the following error when running nix*
# error: the group 'nixbld' specified in 'build-users-group' does not exist # error: the group 'nixbld' specified in 'build-users-group' does not exist
add_config "build-users-group =" add_config "build-users-group ="
mkdir -m 0755 /etc/nix
cp $workdir/nix.conf /etc/nix/nix.conf
fi fi
if [[ $INPUT_INSTALL_OPTIONS != "" ]]; then if [[ $INPUT_INSTALL_OPTIONS != "" ]]; then
IFS=' ' read -r -a extra_installer_options <<< $INPUT_INSTALL_OPTIONS IFS=' ' read -r -a extra_installer_options <<< "$INPUT_INSTALL_OPTIONS"
installer_options=("${extra_installer_options[@]}" "${installer_options[@]}") installer_options=("${extra_installer_options[@]}" "${installer_options[@]}")
fi fi
echo "installer options: ${installer_options[@]}" echo "installer options: ${installer_options[*]}"
sh <(curl --retry 5 --retry-connrefused -L "${INPUT_INSTALL_URL:-https://nixos.org/nix/install}") "${installer_options[@]}"
# There is --retry-on-errors, but only newer curl versions support that
curl_retries=5
while ! curl -o "$workdir/install" -v --fail -L "${INPUT_INSTALL_URL:-https://nixos.org/nix/install}"
do
sleep 1
((curl_retries--))
if [[ $curl_retries -le 0 ]]; then
echo "curl retries failed" >&2
exit 1
fi
done
sh "$workdir/install" "${installer_options[@]}"
if [[ $OSTYPE =~ darwin ]]; then if [[ $OSTYPE =~ darwin ]]; then
# macOS needs certificates hints # macOS needs certificates hints