Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Setup develop environment with Nix flake #120

Merged
merged 10 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_PATH: "vendor/bundle"
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "daily"
- package-ecosystem: "bundler"
directory: "/"
interval: 'daily'
- package-ecosystem: 'bundler'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
versioning-strategy: increase
groups:
rubocop-dependencies:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint GitHub Actions workflows
on:
push:
branches:
- main
paths:
- '.github/**'
pull_request:
paths:
- '.github/**'
workflow_dispatch:

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
38 changes: 38 additions & 0 deletions .github/workflows/ci-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI - Nix
on:
push:
branches: [main]
paths:
- '.github/workflows/ci-dev.yml'
- '*.nix'
- 'flake.lock'
- '.ruby-version'
- 'dprint.json'
pull_request:
paths:
- '.github/workflows/ci-dev.yml'
- '*.nix'
- 'flake.lock'
- '.ruby-version'
- 'dprint.json'
schedule:
# About JST 8:00
- cron: '0 17 * * *'
workflow_dispatch:

jobs:
tasks:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@v2
- uses: DeterminateSystems/magic-nix-cache-action@v2
Comment on lines +29 to +30
Copy link
Owner Author

Choose a reason for hiding this comment

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

kachick/nixpkgs-url@ac9ec25 Which is better 👀

Copy link
Owner Author

Choose a reason for hiding this comment

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

Copy link
Owner Author

Choose a reason for hiding this comment

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

Much fast! https://github.com/kachick/eqq/actions/runs/5470886853/jobs/9961455751?pr=120

No concern except cache key name does not have any specifal prefix 🤔 https://github.com/kachick/eqq/actions/caches

- run: nix flake check
- run: nix develop --command ./bin/setup
- name: Log current versions
run: nix develop --command bundle exec rake inspect_dependencies
- name: Test with external depdendencies
run: nix develop --command bundle exec rake check_non_ruby
- name: Test with Ruby
run: nix develop --command bundle exec rake simulate_ci
63 changes: 31 additions & 32 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "main" ]
branches: ['main']
paths-ignore:
- '**.md'
- '.vscode/**'
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ['main']
paths-ignore:
- '**.md'
- '.vscode/**'
Expand All @@ -38,45 +38,44 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'ruby' ]
language: ['ruby']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{matrix.language}}'
15 changes: 15 additions & 0 deletions .github/workflows/dprint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: dprint
on:
push:
branches: [main]
pull_request:

jobs:
check:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dprint/check@v2.2
with:
dprint-version: '0.36.1'
1 change: 1 addition & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jobs:
name: Build and deploy YARD
steps:
- uses: kachick/deploy-yard-to-pages@v1
id: deployment
20 changes: 10 additions & 10 deletions .github/workflows/test_behaviors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
ruby: [head, '3.2', '3.1']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
env:
BUNDLE_WITHOUT: development
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake test_behaviors --suppress-backtrace='\/bundle'
env:
BUNDLE_WITHOUT: development
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
env:
BUNDLE_WITHOUT: development
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake test_behaviors --suppress-backtrace='\/bundle'
env:
BUNDLE_WITHOUT: development
12 changes: 6 additions & 6 deletions .github/workflows/test_signatures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
ruby: ['3.2']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake validate_signatures >/dev/null
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake validate_signatures >/dev/null
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
*.gem
*.rbc
.bundle
.bundle/*
!.bundle/config
.config
.DS_Store
.ruby-version
coverage
coverage.data
InstalledFiles
Expand Down Expand Up @@ -36,3 +36,6 @@ doc/
*.bak
tool/
*\#*

!flake.lock
.direnv
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.2
12 changes: 12 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"recommendations": [
"editorconfig.editorconfig",
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"koichisasada.vscode-rdbg",
"soutaro.steep-vscode",
"soutaro.rbs-syntax",
"dprint.dprint",
"jnoortheen.nix-ide"
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"editor.defaultFormatter": "dprint.dprint",
"editor.formatOnSave": true,
"[nix]": {
"editor.defaultFormatter": "jnoortheen.nix-ide"
},
"cSpell.words": [
"cachix",
"dprint",
"nixos",
"nixpkgs"
]
}
21 changes: 17 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# How to contribute

* Reporting bugs
* Suggesting features
* Creating PRs
- Reporting bugs
- Suggesting features
- Creating PRs

Welcome all of the contributions!

Expand All @@ -17,7 +17,20 @@ $ ./bin/setup
# Installed!
```

## Feel the latest version with REPL
Using several tools, not limited to the Ruby ecosystem.
An example is [dprint](https://github.com/dprint/dprint).

This project is providing nix flake config for setup around them.
After installing [Nix](https://nixos.org/) package manager, you can do following.

```console
$ nix develop
$ dprint check
$ actionlint
...
```

## Try latest version with REPL

```console
$ ./bin/console
Expand Down
Loading