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

Update various dependencies #34

Merged
merged 10 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
45 changes: 14 additions & 31 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
#!/usr/bin/env bash

set -ueo pipefail
# Run lintball using Docker on git commit

# Ensure ARM64 homebrew and /usr/local/bin are in PATH before system PATH.
# This finds /usr/local/bin/lintball and finds newer Homebrew-installed bash.
export PATH
PATH=~/.asdf/shims":/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:$PATH"
set -eu

export LINTBALL_DIR
LINTBALL_DIR="${LINTBALL_DIR:-node_modules/lintball}"
workspace=$(git rev-parse --show-toplevel || true)
if [[ -z ${workspace} ]]; then
echo "Could not determine git repository path" >&2
exit 1
fi

if [ -f "${LINTBALL_DIR}/bin/lintball" ]; then
"${LINTBALL_DIR}/bin/lintball" pre-commit
elif [ -n "$(command -v lintball)" ]; then
lintball pre-commit
if [[ -f "${workspace}/scripts/build-local-docker-image.sh" ]]; then
# This is lintball itself, build and use the local image
"${workspace}/scripts/build-local-docker-image.sh"
image=lintball:local
else
{
echo
echo "Error: could not find a lintball executable, but lintball's pre-commit hook is enabled."
echo
echo "Solutions:"
echo
echo '- Install lintball globally:'
echo ' npm install -g lintball'
echo '- And/or, ensure that that lintball can be found in PATH:'
# shellcheck disable=SC2016
echo ' ln -s "$(command -v lintball)" /usr/local/bin/'
echo
echo 'Workarounds:'
echo
echo '- Disable all git hooks:'
echo ' git config --local core.hooksPath ""'
echo "- Delete ${BASH_SOURCE[0]}"
echo
} >&2
exit 1
image=elijahru/lintball:latest
fi

docker run -v "${workspace}:/workspace" "${image}" lintball pre-commit
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
title: ""
labels: bug
assignees: ''
assignees: ""
---

**Describe the bug**
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
title: ""
labels: enhancement
assignees: ''
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: build
# yamllint disable rule:truthy
on:
pull_request:
branches: ['*']
branches: ["*"]
paths:
- .github/workflows/build.yml # changes to this file
- bin/** # changes to asdf entrypoint scripts
Expand All @@ -15,8 +15,8 @@ on:
- test/** # changes to tests
- package*.json # bats upgrade
push:
branches: ['main']
tags: ['*']
branches: ["main"]
tags: ["*"]
paths:
- .github/workflows/build.yml # changes to this file
- bin/** # changes to asdf entrypoint scripts
Expand All @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout plugin
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '15'
node-version: "22"

- name: Run tests
run: |
Expand All @@ -60,39 +60,39 @@ jobs:
include:
# Stable binary
- os: ubuntu-latest
nim-version: 'latest:1.6'
nim-version: "latest:1.6"
platform: linux-glibc

# Stable binary
- os: ubuntu-latest
nim-version: 'latest:1.4'
nim-version: "latest:2.2"
platform: linux-glibc

# Unstable binary
- os: ubuntu-latest
nim-version: 'ref:version-1-6'
nim-version: "ref:version-2-0"
platform: linux-glibc

# Unstable binary
- os: macos-latest
nim-version: 'ref:devel'
nim-version: "ref:devel"
platform: macOS

# Build from source
- os: ubuntu-latest
nim-version: 'ref:HEAD'
nim-version: "ref:HEAD"
platform: linux-glibc

# Build from source
- os: macos-latest
nim-version: 'latest:1.4'
nim-version: "latest:2.2"
platform: macOS

steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
if: matrix.nim-version != 'ref:HEAD' && matrix.nim-version != 'latest'
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache
key: cache-${{ matrix.os }}-${{ matrix.nim-version }}
Expand All @@ -102,10 +102,10 @@ jobs:
run: brew install bash parallel

- name: Install asdf
uses: asdf-vm/actions/setup@v1
uses: asdf-vm/actions/setup@v3

- name: Checkout plugin
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install asdf-nim & test
shell: bash
Expand All @@ -120,14 +120,14 @@ jobs:

# Test musl installation
plugin_test_x86_musl:
name: 👑1.6.8/linux-musl/x86_64
name: 👑2.2.x/linux-musl/x86_64
runs-on: ubuntu-latest
container: alpine:latest

steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache
key: cache-ubuntu-latest-${{ matrix.nim-version }}
Expand All @@ -139,7 +139,7 @@ jobs:
uses: asdf-vm/actions/plugin-test@v1
with:
command: nim -v
version: 'latest:1.6'
version: "latest:2.2"

# Test installation for a few non-x86 architectures
plugin_test_non_x86:
Expand All @@ -152,24 +152,24 @@ jobs:
include:
# Unstable binary
- runs-on: ubuntu-latest
nim-version: 'ref:version-1-6'
nim-version: "ref:version-2-2"
arch: aarch64

# Unstable binary
- runs-on: ubuntu-latest
nim-version: 'ref:version-1-4'
nim-version: "ref:version-1-6"
arch: armv7

steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache
key: cache-${{ matrix.arch }}-${{ matrix.nim-version }}

- name: Checkout plugin
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install & run tests on non-x86
- uses: uraimo/run-on-arch-action@v2
Expand Down
72 changes: 11 additions & 61 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,24 @@
name: lint

name: Lint
# yamllint disable rule:truthy
on:
pull_request:
branches: ['*']
branches: ["*"]
push:
branches: ['*']
tags: ['*']
branches: ["*"]
tags: ["*"]
# yamllint enable rule:truthy

jobs:
lint:
name: Lint
name: lint

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
uses: actions/checkout@v4
with:
node-version: '15'

- uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install shfmt
uses: mfinelli/setup-shfmt@v2

- name: Install lintball
run: |
npm install -g [email protected]
lintball install-tools --yes sh yml md

- name: Check for linter issues
shell: bash
run: |
set -uexo pipefail
fetch-depth: 0 # This is necessary for linting only recent changes

default_branch=main
if [ "$GITHUB_REF" = "refs/heads/$default_branch" ]; then
# A push to the default branch.
# Check files which were changed in the most recent commit.
commitish="HEAD~1"
elif [ -n "$GITHUB_BASE_REF" ]; then
# A pull request.
# Check files which have changed between the merge base and the
# current commit.
commitish="$(git merge-base -a refs/remotes/origin/$GITHUB_BASE_REF $GITHUB_SHA)"
else
# A push to a non-default, non-PR branch.
# Check files which have changed between default branch and the current
# commit.
commitish="$(git merge-base -a refs/remotes/origin/${default_branch} $GITHUB_SHA)"
fi
# Get the list of changed files
files="$(git diff --name-only "$commitish")"
# Check if any lintball configuration was changed. If so, check all files.
status=0
case "$files" in
*lintballrc.json* | *.yamllint.yml* | *lint.yml*) lintball check || status=$? ;;
*) lintball check --since "$commitish" || status=$? ;;
esac
if [ "$status" -gt 0 ]; then
echo
echo "The above issues were found by lintball."
echo "To detect and auto-fix issues before pushing, install lintball's git hooks."
echo "See https://github.com/elijahr/lintball"
echo
exit $status
fi
- name: Run lintball
uses: elijahr/lintball@v2
31 changes: 20 additions & 11 deletions .lintballrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"lintballrc_version": "2",
"check_args": {
"yamllint": "-c ./.yamllint.yml"
"yamllint": [
"{{tool}}",
"--format",
"{{format}}",
"--strict",
"--config-file",
"./.yamllint.yml",
"{{path}}"
]
},
"write_args": {
"yamllint": "-c ./.yamllint.yml"
"yamllint": [
"{{tool}}",
"--format",
"{{format}}",
"--strict",
"--config-file",
"./.yamllint.yml",
"{{path}}"
]
},
"use": {
"autoflake": false,
Expand All @@ -14,16 +31,8 @@
"prettier": true,
"prettier-eslint": true,
"pylint": false,
"rubocop": false,
"shellcheck": true,
"shfmt": true,
"yamllint": true
},
"ignores": [
"*/.git/*",
"*/Gemfile.lock",
"*/Pipfile.lock",
"*/venv/*",
"*/src/*"
]
}
}
1 change: 1 addition & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
disable=SC2154,SC2312,SC2310
4 changes: 2 additions & 2 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
yaml-files:
- '*.yaml'
- '*.yml'
- "*.yaml"
- "*.yml"

rules:
braces: enable
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v2.0.2 - 2024-11-06

- test against newer nims
- update documentation for newer nims
- upgrade lintball

## v2.0.1 - 2022-11-28

- fix: sorting for `asdf list-all nim`
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM ubuntu

RUN apt-get update && apt-get install -y git curl build-essential \
&& rm -rf /var/lib/apt/lists/* \
&& git clone https://github.com/asdf-vm/asdf.git ~/.asdf --depth 1 --single-branch --branch v0.10.2 \
&& rm -rf /var/lib/apt/lists/* \
&& git clone https://github.com/asdf-vm/asdf.git ~/.asdf --depth 1 --single-branch --branch v0.14.1 \
&& echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc \
&& echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc

Expand Down
Loading
Loading