Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Prettier formatting #168

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 9 additions & 10 deletions .github/dependabot.yml
@@ -1,13 +1,12 @@
version: 2
updates:

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: '00:00'
timezone: UTC
open-pull-requests-limit: 10
commit-message:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "00:00"
timezone: UTC
open-pull-requests-limit: 10
commit-message:
prefix: "chore"
include: "scope"
include: "scope"
116 changes: 63 additions & 53 deletions .github/workflows/test.yml
Expand Up @@ -12,93 +12,103 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
- run: cat /etc/nix/nix.conf
# cachix should be available and be able to configure a cache
- run: cachix use cachix
- run: nix-build test.nix
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
- run: cat /etc/nix/nix.conf
# cachix should be available and be able to configure a cache
- run: cachix use cachix
- run: nix-build test.nix
custom-nix-path:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-20.03
- run: test $NIX_PATH == "nixpkgs=channel:nixos-20.03"
- run: nix-build test.nix
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-20.03
- run: test $NIX_PATH == "nixpkgs=channel:nixos-20.03"
- run: nix-build test.nix

extra-nix-config:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
sandbox = relaxed
- run: cat /etc/nix/nix.conf
- run: nix-build test.nix --arg noChroot true
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
sandbox = relaxed
- run: cat /etc/nix/nix.conf
- run: nix-build test.nix --arg noChroot true

flakes:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
- run: nix flake show github:NixOS/nixpkgs
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
- run: nix flake show github:NixOS/nixpkgs

installer-options:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
install_options: --tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve
install_url: https://nixos-nix-install-tests.cachix.org/serve/s62m7lc0q0mz2mxxm9q0kkrcg90njzhq/install
- run: nix-build test.nix
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
install_options: --tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve
install_url: https://nixos-nix-install-tests.cachix.org/serve/s62m7lc0q0mz2mxxm9q0kkrcg90njzhq/install
- run: nix-build test.nix

oldest-supported-installer:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
install_url: https://releases.nixos.org/nix/nix-2.8.0/install
- run: nix-build test.nix
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
install_url: https://releases.nixos.org/nix/nix-2.8.0/install
- run: nix-build test.nix

act-support:
strategy:
matrix:
os: [ubuntu-latest]
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- run: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
- run: docker pull ghcr.io/catthehacker/ubuntu:js-20.04
- run: ./bin/act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:js-20.04 push -j simple-build
- uses: actions/checkout@v3
- run: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
- run: docker pull ghcr.io/catthehacker/ubuntu:js-20.04
- run: ./bin/act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:js-20.04 push -j simple-build

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
- run: nix-shell --packages cacert git nodejs pre-commit --pure --run 'pre-commit run --all-files'
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -91,3 +91,6 @@ typings/

# DynamoDB Local files
.dynamodb/

# JetBrains IDEA configuration
/.idea/
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,9 @@
# Configuration file for pre-commit (https://pre-commit.com/).
# Please run `pre-commit run --all-files` when adding or changing entries.

repos:
- repo: https://github.com/pre-commit/mirrors-prettier
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@l0b0 l0b0 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm completely unfamiliar with that, so I'd have to look into it. Unfortunately devenv isn't even in nixpkgs, so this will require a fair bit more setup. If someone else is up for converting this to devenv, feel free!

I've split off two commits which are only tangentially related to separate PRs.

rev: 6f3cb139ef36133b6f903b97facc57b07cef57c9 # frozen: v3.0.0-alpha.6
hooks:
- id: prettier
stages: [commit]
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -33,11 +33,11 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-build
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-build
```

## Usage with Flakes
Expand All @@ -51,12 +51,12 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build
- run: nix flake check
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build
- run: nix flake check
```

To install Nix from any commit, go to [the corresponding installer_test action](https://github.com/NixOS/nix/runs/2219534360) and click on "Run cachix/install-nix-action@XX" step and expand the first line.
Expand Down
24 changes: 12 additions & 12 deletions action.yml
@@ -1,24 +1,24 @@
name: 'Install Nix'
description: 'Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.'
author: 'Domen Kožar'
name: "Install Nix"
description: "Installs Nix on GitHub Actions for the supported platforms: Linux and macOS."
author: "Domen Kožar"
inputs:
extra_nix_config:
description: 'Gets appended to `/etc/nix/nix.conf` if passed.'
description: "Gets appended to `/etc/nix/nix.conf` if passed."
github_access_token:
description: 'Configure nix to pull from github using the given github token.'
description: "Configure nix to pull from github using the given github token."
install_url:
description: 'Installation URL that will contain a script to install Nix.'
description: "Installation URL that will contain a script to install Nix."
install_options:
description: 'Additional installer flags passed to the installer script.'
description: "Additional installer flags passed to the installer script."
nix_path:
description: 'Set NIX_PATH environment variable.'
description: "Set NIX_PATH environment variable."
branding:
color: 'blue'
icon: 'sun'
color: "blue"
icon: "sun"
runs:
using: 'composite'
using: "composite"
steps:
- run : ${GITHUB_ACTION_PATH}/install-nix.sh
- run: ${GITHUB_ACTION_PATH}/install-nix.sh
shell: bash
env:
INPUT_EXTRA_NIX_CONFIG: ${{ inputs.extra_nix_config }}
Expand Down