Skip to content

Commit

Permalink
Configure automated releases with build artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
OldhamMade committed Dec 29, 2020
1 parent 1596307 commit de91316
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
include:
- target:
os: linux
builder: ubuntu-18.04
builder: ubuntu-latest
- target:
os: macos
builder: macos-10.15
builder: macos-latest

name: '${{ matrix.target.os }}-nim${{ matrix.target.nim_version }} (${{ matrix.branch }})'
runs-on: ${{ matrix.builder }}
Expand Down
95 changes: 93 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ on:
- main
- master

env:
RELEASE_VERSION: production
UPLOAD_URL: ""

jobs:
release:
name: Create Release
name: "Release"
runs-on: ubuntu-latest

steps:
Expand All @@ -29,7 +33,8 @@ jobs:
uses: gittools/actions/gitversion/[email protected]

- name: "[Version] Capture"
run: echo "RELEASE_VERSION=${{ steps.gitversion.outputs.semVer }}" >> $GITHUB_ENV
run: |
echo "RELEASE_VERSION=${{ steps.gitversion.outputs.semVer }}" >> $GITHUB_ENV
- name: "[Release] Create"
id: create_release
Expand All @@ -43,3 +48,89 @@ jobs:
Please see the changelog for details of this release
draft: false
prerelease: false

- name: "[Release] Capture"
run: |
echo "UPLOAD_URL=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_ENV
- name: "[Release] Capture vars"
run: |
echo "${{env.RELEASE_VERSION}}" > version
echo "${{env.UPLOAD_URL}}" > uploadurl
- name: "[Release] Upload artifacts"
uses: actions/upload-artifact@v1
with:
name: details
path: version

- name: "[Release] Upload artifacts"
uses: actions/upload-artifact@v1
with:
name: details
path: uploadurl

artifacts:
strategy:
fail-fast: false
max-parallel: 20
matrix:
os:
- ubuntu-latest
- macos-latest

name: "Build: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs: release

steps:
- name: "[Git] Checkout code"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "[Release] Download artifacts"
uses: actions/download-artifact@v1
with:
name: details

- name: "[Env] Write"
run: |
mv details/* .
echo "RELEASE_VERSION=$(cat version)" >> $GITHUB_ENV
echo "UPLOAD_URL=$(cat uploadurl)" >> $GITHUB_ENV
- name: "[Build] Install deps"
if: runner.os == 'Linux'
run: |
sudo apt-fast update -qq
sudo apt-fast --no-install-recommends -yq install curl git
- name: "[Build] Install asdf"
run: |
[ -d ~/.asdf ] || git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
- name: "[Build] Install nim"
run: |
source $HOME/.asdf/asdf.sh
[ -e $(asdf plugin list|grep nim) ] && asdf plugin add nim
asdf install nim latest
- name: "[Build] Create build for ${{ matrix.os }}"
run: |
source $HOME/.asdf/asdf.sh
asdf info
asdf global nim $(asdf list nim|tail -n 1)
make release
tar czf ll-${{env.RELEASE_VERSION}}-${{ matrix.os }}.tar.gz ./ll
- name: "[Release] Upload build for ${{ matrix.os }} to ${{env.UPLOAD_URL}}"
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{env.UPLOAD_URL}}
asset_path: ll-${{env.RELEASE_VERSION}}-${{ matrix.os }}.tar.gz
asset_name: ll-${{env.RELEASE_VERSION}}-${{ matrix.os }}.tar.gz
asset_content_type: application/gzip
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ profile: ## run profiler
@nimble profile

release: ## release build, optimised for speed
@nimble -y build --nilseqs:on --verbose --opt:speed -d:release # --passC:-Ofast --threads:off --threadanalysis:off
@nimble -y build \
-d:release \
--gc:arc \
--deepCopy:on \
--nilseqs:on \
--verbose \
--opt:speed \
# --passC:-Ofast \
# --threads:off \
# --threadanalysis:off

install: release ## create a release build and install to /usr/local/bin
@mv ./ll /usr/local/bin/ll
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# `ll` - a more informative `ls`, based on [`k`][1]
# `ll` - a more informative `ls`, based on [`k`][k]

![CI](https://github.com/OldhamMade/ll/workflows/CI/badge.svg)


## Description

`ll` is an alternative to [`k`][1], which was created to make
`ll` is an alternative to [`k`][k], which was created to make
directory listings more informative and readable, using colour to add
visual weight to important information in the listing.

### Motivation

[`k`][1] only works with [`zsh`][2], and I've found that it can
[`k`][k] only works with [`zsh`][zsh], and I've found that it can
occasionally be a little slow when working with large directories or
with large git repositories. I was looking for a project which would
be a good match to learn/use [`nim`][3], and this seemed like a great
be a good match to learn/use [`nim`][nim], and this seemed like a great
opportunity to make something a little more general-purpose that could
be used without the [`zsh`][2] dependency.
be used without the [`zsh`][zsh] dependency.

## Features

Expand Down Expand Up @@ -69,17 +69,19 @@ listings with many git-tracked entries `ll` is still sub-second.

## Installation

Binary distributions are planned, but for now it's possible to build
and install using the following instructions.
[The latest binary distribution is avilable here.][builds]

It is also possible to build and install using the following
instructions:

### Requirements

- [Nim][3], minimum v1.2.*
- [Nim][nim], minimum v1.2.*
- `make`

### Steps

Firstly install [Nim][3]. I personally use [`asdf`][6] to manage Nim
Firstly install [Nim][nim]. I personally use [`asdf`][asdf] to manage Nim
versions on my machine. With `asdf` installed, this is as simple as
calling `asdf install nim latest`.

Expand Down Expand Up @@ -110,9 +112,9 @@ That's it. For more options, pass `-?` or `--help`.
- [ ] Support light themes
- [ ] Support globs

### Fixes over [`k`][1]
### Fixes over [`k`][k]

* [`k`][1] has an odd behaviour; given `pwd` is a git-tracked
* [`k`][k] has an odd behaviour; given `pwd` is a git-tracked
directory, if you `k somedir` where `somedir` contains git-tracked
directories but isn't itself tracked, `k` reports as though it is
working inside a work-tree. `ll` reports this as one would expect, as
Expand All @@ -121,7 +123,7 @@ though `pwd` is `somedir`. **UPDATE:** This has now

### Future plans

According to the [`k`][1] source, there are future plans to colorise
According to the [`k`][k] source, there are future plans to colorise
file permissions. If this happens, I plan to bring those changes
over. If any other enhancements are added, I hope to port those also.

Expand Down Expand Up @@ -164,8 +166,8 @@ You may view the LICENSE in which this software is provided to you
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[1]: https://github.com/supercrabtree/k
[2]: https://en.wikipedia.org/wiki/Z_shell
[3]: https://nim-lang.org
[4]: https://en.wikipedia.org/wiki/Kanban
[6]: https://github.com/asdf-vm/asdf
[k]: https://github.com/supercrabtree/k
[zsh]: https://en.wikipedia.org/wiki/Z_shell
[nim]: https://nim-lang.org
[asdf]: https://github.com/asdf-vm/asdf
[builds]: https://github.com/OldhamMade/ll/releases/latest
14 changes: 7 additions & 7 deletions src/ll.nim
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import llpkg/display

const
AppName = "ll"
AppVersion = "0.1.1"
AppVersionFull = "$1, version $2".format(AppName, AppVersion)
AppVersion = staticRead("../version")
AppVersionFull = "$1, version: $2".format(AppName, AppVersion)


type
Expand Down Expand Up @@ -81,19 +81,19 @@ type
id: tuple[device: DeviceId, file: FileId]
kind: FileType
size: BiggestInt
permissions: set[FilePermission]
owner: tuple[group: Gid, user: Uid]
symlink: string
symlinkBroken: bool
linkCount: BiggestInt
creationTime: times.Time
lastAccessTime: times.Time
lastWriteTime: times.Time
lastWriteTimeNanosec: int
creationTime: times.Time
blocks: int
owner: tuple[group: Gid, user: Uid]
symlink: string
symlinkBroken: bool
executable: bool
mode: Mode
hidden: bool
permissions: set[FilePermission]
gitInsideWorkTree: bool
gitStatus: GitStatus

Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
development

0 comments on commit de91316

Please sign in to comment.