49 Commits

Author SHA1 Message Date
1e72dbcfc2 feat: Bumps version
All checks were successful
CI / Run Tests (push) Successful in 2m36s
Release / release (push) Successful in 7s
2024-12-18 11:42:36 -05:00
a5b9280a46 feat: Adds release workflow to gitea
Some checks failed
CI / Run Tests (push) Has been cancelled
2024-12-18 11:41:39 -05:00
4b9c45dd5f fix: Fixes docker tests now that we're using curl to download configuration template file.
All checks were successful
CI / Run Tests (push) Successful in 3m2s
2024-12-18 10:54:09 -05:00
529aa80c47 feat: Updates to test homebrew
Some checks failed
CI / Run Tests (push) Failing after 2m34s
2024-12-18 10:18:28 -05:00
66e286f267 fix: Fixes merge conflicts
Some checks failed
CI / Run Tests (push) Failing after 41s
2024-12-18 08:22:18 -05:00
cb25dba7de feat: Updating just file
All checks were successful
CI / Run Tests (push) Successful in 2m52s
2024-12-18 08:15:26 -05:00
9b99b35436 feat: Uses curl to download toml config to allow for pre-built binaries.
Some checks failed
CI / Run Tests (push) Failing after 2m44s
2024-12-17 19:03:16 -05:00
fb246df01a fix: Fixes failing tests since we create backups now during configuration generation.
All checks were successful
CI / Run Tests (push) Successful in 2m43s
CI / Run Tests (pull_request) Successful in 2m22s
2024-12-17 15:44:51 -05:00
0b153d7990 fix: Removes unused release workflow
Some checks failed
CI / Run Tests (push) Failing after 2m52s
CI / Run Tests (pull_request) Failing after 2m15s
2024-12-17 15:32:15 -05:00
558054464c feat: Create backups of configuration when the force option is not used.
Some checks failed
CI / Run Tests (push) Failing after 2m16s
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
2024-12-17 14:38:52 -05:00
54c07886ad feat: Adding documentation comments.
All checks were successful
CI / Run Tests (push) Successful in 2m28s
2024-12-17 13:32:05 -05:00
f8e89ed0fa feat: Adding documentation comments.
All checks were successful
CI / Run Tests (push) Successful in 2m17s
2024-12-17 11:51:03 -05:00
f596975bbc feat: Fix test-docker command to not use TTY for CI tests.
All checks were successful
CI / Run Tests (push) Successful in 2m28s
2024-12-17 10:25:24 -05:00
805100fa43 feat: Adds ci
Some checks failed
CI / Run Tests (push) Failing after 3m47s
2024-12-17 10:17:46 -05:00
f7f168b7fd feat: Begins adding docker containers 2024-12-17 10:15:07 -05:00
99459a0a71 feat: Adds dump-configuration command. 2024-12-16 20:44:30 -05:00
f89efc8c5e feat: Adds file-client tests. 2024-12-16 19:00:42 -05:00
85b285347b feat: Removes cli-client 2024-12-16 17:14:25 -05:00
8c402f3f5f feat: Adds command documentation about piping to other commands. 2024-12-16 12:41:49 -05:00
1429c51821 feat: Adds output values to some of the commands to allow them to be piped into other commands 2024-12-16 12:28:38 -05:00
1302b15ee2 feat: Integrates vault-client into hpa-executable. 2024-12-16 10:57:14 -05:00
da810d0a45 feat: Integrates playbook client into hpa-executable. 2024-12-16 10:29:58 -05:00
35d9422f07 feat: Updates playbook client initialization. 2024-12-15 21:16:11 -05:00
601869d457 feat: Adds vault client 2024-12-15 17:27:28 -05:00
6d0108da0c feat: Adds createProject and createJson tests for playbook-client. 2024-12-15 11:59:50 -05:00
bc0b740f95 feat: Moves playbook run into playbook client, need to move tests. 2024-12-14 23:14:01 -05:00
303cdef84b feat: Preparing to move items out of cli-client module into playbook-client 2024-12-14 10:06:30 -05:00
b5afc77428 feat: Beginning to refactor cli-client 2024-12-13 23:00:40 -05:00
3f56dda568 feat: Adds generate commands that call to pandoc to generate pdf, latex, and html files from a project. 2024-12-13 15:33:20 -05:00
d1b3379815 feat: Adds playbook client 2024-12-13 11:27:43 -05:00
b557a60fa3 feat: Adds build-with-version plugin. 2024-12-13 08:19:36 -05:00
5f4ef3b5b5 feat: Moves playbook into resources of cli-client. 2024-12-12 19:39:52 -05:00
ba1e61d99e feat: Updates 'extraArgs' naming to 'extraOptions' as it's more inline with the usage of them 2024-12-12 18:21:13 -05:00
bd56660683 feat: fixes improper json when creating a project using a repository 2024-12-12 18:01:32 -05:00
a480e942bc feat: fixes install dependencies to use texlive 2024-12-12 17:01:56 -05:00
2b265a4ca5 feat: Adds install-dependencies command. 2024-12-12 13:39:11 -05:00
56a0bca00c feat: Fixes not creating default config directory 2024-12-12 12:37:14 -05:00
7b30b78b67 feat: Moves logging setup and generate-json for the create command to cli-client module. 2024-12-12 11:16:22 -05:00
ce6eb3ec2f feat: Working on moving commands to cli-client 2024-12-12 07:46:26 -05:00
8302ede99e fix: Fixes gitignore to not ignore configuration resources. 2024-12-11 18:15:11 -05:00
d9e91538fb feat: Adds more tests for cli-client. 2024-12-11 17:03:43 -05:00
c1a14ea855 feat: Moves commands into cli-client module, adds tests, needs implemented in the executable. 2024-12-11 14:41:06 -05:00
ddb5e6767a feat: Begins moving run commands into cli-client module 2024-12-11 12:31:41 -05:00
9c784d4dcb feat: Breaking out more dependencies. 2024-12-11 09:23:34 -05:00
92cd6afa2b feat: Breaking out more dependencies. 2024-12-10 17:08:17 -05:00
87390c4b63 feat: Begins work on supporting toml for configuration. 2024-12-09 17:00:52 -05:00
a8d35fed37 feat: Updates cli documentation for utils commands. 2024-12-09 11:43:31 -05:00
357914ba93 feat: Updates cli documentation to use the swift-cli-doc package. 2024-12-09 11:27:27 -05:00
a39536364b feat: Commit pre switch to swift-cli-doc package. 2024-12-09 09:43:04 -05:00
11 changed files with 82 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
---
name: Release
on:
push:
tags:
- "*.*.*"
- "v*.*.*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true

2
.gitignore vendored
View File

@@ -10,3 +10,5 @@ DerivedData/
.swiftpm/*
./hpa.toml
./Version.*
/*.json
hpa

View File

@@ -1,5 +1,5 @@
{
"originHash" : "bc31b11e5e7d488e0a9c1bf91cb572d29f782bfd8e43f44157036f8f3d282893",
"originHash" : "f1d1e27e3b3b21d41b872325e0174196a323dc438bf3c9d9f99858856b457c96",
"pins" : [
{
"identity" : "combine-schedulers",
@@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://git.housh.dev/michael/swift-cli-doc.git",
"state" : {
"revision" : "e524056dc65c5ce7a6a77bdea4e5fa0bf724019b",
"version" : "0.2.0"
"revision" : "bbace73d974fd3e6985461431692bea773c7c5d8",
"version" : "0.2.1"
}
},
{

View File

@@ -20,7 +20,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-custom-dump.git", from: "1.3.3"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.5.2"),
.package(url: "https://github.com/m-housh/swift-shell-client.git", from: "0.1.0"),
.package(url: "https://git.housh.dev/michael/swift-cli-doc.git", from: "0.2.0"),
.package(url: "https://git.housh.dev/michael/swift-cli-doc.git", from: "0.2.1"),
.package(url: "https://github.com/m-housh/swift-cli-version.git", from: "0.1.0"),
.package(url: "https://github.com/LebJe/TOMLKit.git", from: "0.5.0")
],
@@ -70,6 +70,7 @@ let package = Package(
name: "ConfigurationClient",
dependencies: [
"CodersClient",
"CommandClient",
"FileClient",
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "DependenciesMacros", package: "swift-dependencies"),

View File

@@ -1,4 +1,5 @@
import CodersClient
import CommandClient
import Dependencies
import DependenciesMacros
import FileClient
@@ -155,6 +156,7 @@ struct LiveConfigurationClient {
private let environment: [String: String]
@Dependency(\.coders) var coders
@Dependency(\.commandClient) var commandClient
@Dependency(\.fileClient) var fileManager
@Dependency(\.logger) var logger
@@ -245,19 +247,13 @@ struct LiveConfigurationClient {
try await fileManager.createDirectory(fileDirectory)
}
// TODO: The hpa file needs to be copied somewhere on the system during install and
// not use bundle, as it only works if the tool was built on the users system.
if case .toml = file {
// In the case of toml, we copy the internal resource that includes
// usage comments in the file.
guard let resourceFile = Bundle.module.url(
forResource: HPAKey.resourceFileName,
withExtension: HPAKey.resourceFileExtension
) else {
throw ConfigurationError.resourceNotFound
}
try await fileManager.copy(resourceFile, fileUrl)
// Copy the file using curl, because when installed as a pre-built binary we
// don't have access to bundled resources.
try await commandClient.run(
quiet: true,
["curl", HPAKey.tomlConfigUrl, "--output", fileUrl.path]
)
} else {
// Json does not allow comments, so we write the mock configuration
// to the file path.

View File

@@ -15,6 +15,7 @@ public enum HPAKey {
public static let resourceFileExtension = "toml"
public static let defaultFileName = "config.toml"
public static let defaultFileNameWithoutExtension = "config"
public static let tomlConfigUrl = "https://git.housh.dev/michael/swift-hpa/raw/branch/main/Sources/ConfigurationClient/Resources/hpa.toml"
}
extension [String: String] {

View File

@@ -1,2 +1,2 @@
// Do not set this variable, it is set during the build process.
let VERSION: String? = "0.1.1"
let VERSION: String? = "0.1.5"

View File

@@ -18,6 +18,8 @@ struct ConfigurationClientTests: TestCase {
@Test(arguments: ["config.toml", "config.json"])
func generateConfigFile(fileName: String) async throws {
try await withTestLogger(key: "generateConfigFile") {
$0.asyncShellClient = .liveValue
$0.commandClient = .liveValue
$0.coders = .liveValue
$0.fileClient = .liveValue
} operation: {
@@ -42,6 +44,8 @@ struct ConfigurationClientTests: TestCase {
@Test(arguments: ["config.toml", "config.json", nil])
func loadConfigFile(fileName: String?) async throws {
try await withTestLogger(key: "generateConfigFile") {
$0.asyncShellClient = .liveValue
$0.commandClient = .liveValue
$0.coders = .liveValue
$0.fileClient = .liveValue
} operation: {
@@ -65,6 +69,8 @@ struct ConfigurationClientTests: TestCase {
@Test(arguments: ["config.toml", "config.json", ".hparc.json", ".hparc.toml"])
func findConfiguration(fileName: String) async throws {
try await withTestLogger(key: "findConfiguration") {
$0.asyncShellClient = .liveValue
$0.commandClient = .liveValue
$0.fileClient = .liveValue
} operation: {
@Dependency(\.logger) var logger
@@ -94,6 +100,8 @@ struct ConfigurationClientTests: TestCase {
@Test(arguments: ["config.toml", "config.json", ".hparc.json", ".hparc.toml"])
func findXdgConfiguration(fileName: String) async throws {
try await withTestLogger(key: "findXdgConfiguration") {
$0.asyncShellClient = .liveValue
$0.commandClient = .liveValue
$0.fileClient = .liveValue
} operation: {
@Dependency(\.logger) var logger
@@ -133,6 +141,8 @@ struct ConfigurationClientTests: TestCase {
@Test
func writeCreatesBackupFile() async throws {
try await withDependencies {
$0.asyncShellClient = .liveValue
$0.commandClient = .liveValue
$0.fileClient = .liveValue
} operation: {
let client = ConfigurationClient.liveValue

View File

@@ -15,6 +15,7 @@ FROM swift:${SWIFT_IMAGE_VERSION}-slim
RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && apt-get -q update && \
apt-get -q install -y \
ansible \
curl \
pandoc \
texlive \
&& rm -r /var/lib/apt/lists/*

View File

@@ -2,6 +2,11 @@
ARG SWIFT_IMAGE_VERSION="6.0.3"
FROM swift:${SWIFT_IMAGE_VERSION}
RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && apt-get -q update && \
apt-get -q install -y \
curl \
&& rm -r /var/lib/apt/lists/*
WORKDIR /app
COPY ./Package.* ./
RUN swift package resolve

View File

@@ -2,44 +2,68 @@ docker_image_name := "swift-hpa"
install_path := "~/.local/share/bin/hpa"
completion_path := "~/.local/share/zsh/completions/_hpa"
build mode="debug":
swift build -c {{mode}}
tap_url := "https://git.housh.dev/michael/homebrew-formula"
tap := "michael/formula"
formula := "hpa"
# Build and bottle homebrew formula.
bottle:
@brew uninstall {{formula}} || true
@brew tap {{tap}} {{tap_url}}
@brew install --build-bottle {{tap}}/{{formula}}
@brew bottle {{formula}}
bottle="$(ls *.gz)" && mv "${bottle}" "${bottle/--/-}"
# Build the command-line tool.
build configuration="debug" arch="arm64":
swift build \
--disable-sandbox \
--configuration {{configuration}} \
--arch {{arch}}
alias b := build
# Build the docker image.
build-docker file="Dockerfile" tag="latest":
@docker build \
--file docker/{{file}} \
--tag {{docker_image_name}}:{{tag}} .
# Build the docker test image used for testing.
build-docker-test: (build-docker "Dockerfile.test" "test")
build-universal-binary: (build "release" "arm64") (build "release" "x86_64")
@lipo -create -output {{formula}} \
".build/arm64-apple-macosx/release/hpa" \
".build/x86_64-apple-macosx/release/hpa"
# Run tests.
test *ARGS:
swift test {{ARGS}}
alias t := test
# Run tests in docker container.
test-docker *ARGS: (build-docker-test)
@docker run --rm \
--network host \
{{docker_image_name}}:test \
swift test {{ARGS}}
# Run the application.
run *ARGS:
swift run hpa {{ARGS}}
alias r := run
# Clean the build folder.
clean:
rm -rf .build
# Bump the version based on the git tag.
update-version:
@swift package \
--disable-sandbox \
--allow-writing-to-package-directory \
update-version \
hpa
install: (build "release")
@cp .build/release/hpa {{install_path}}
@{{install_path}} --generate-completion-script zsh > {{completion_path}}