dante 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/dante/runner.rb +7 -3
- data/lib/dante/version.rb +1 -1
- metadata +2 -14
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/ci.yml +0 -30
- data/.github/workflows/github-release.yml +0 -69
- data/.github/workflows/release.yml +0 -221
- data/.gitignore +0 -4
- data/Gemfile +0 -4
- data/Rakefile +0 -23
- data/dante.gemspec +0 -29
- data/test/dante_test.rb +0 -16
- data/test/runner_test.rb +0 -1080
- data/test/test_helper.rb +0 -197
- data/test/user_switch_test.rb +0 -314
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 002c335950d80d25888ddea19c51b32dab911ed619240009580a6a8730ad42df
|
|
4
|
+
data.tar.gz: 6ad1ac5e79050b951ff285b4b634cf37be3a210926a4bfab9d21870b11b7acd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de8097d1197747d7169d4b11cc54e6f3f800acb5e4f38cdf73194eadfa46c127c3ddc5ab0ef634ebc18b28d65190b3fdfc8399f27874ad3c7fdba80f99a48a0a
|
|
7
|
+
data.tar.gz: bc9254daba971b9ccb0e0dcc99fb7b13a0366bbc722ed66e74e4016c4fe68711a30584787221de01578219f999a77beb79c4c1c45ae63bf88d5edb80738ff464
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1 (2026-12-02)
|
|
4
|
+
|
|
5
|
+
Changes since 0.4.0:
|
|
6
|
+
|
|
7
|
+
- Fixed: when daemonizing with a pid file in a directory the daemon cannot write and no pid file exists there yet,
|
|
8
|
+
the error reported is the original `Errno::EACCES` rather than `Errno::ENOENT` from the in-place fallback. (#37,
|
|
9
|
+
@nesquena)
|
|
10
|
+
- Packaging: the gem now ships only `lib/`, `LICENSE`, `README.md` and `CHANGELOG.md` instead of every file in
|
|
11
|
+
`git ls-files`, so test files, CI workflows and repository metadata are no longer in the gem. (#38,
|
|
12
|
+
@nesquena)
|
|
13
|
+
|
|
3
14
|
## 0.4.0 (2026-11-01)
|
|
4
15
|
|
|
5
16
|
Changes since 0.3.0:
|
data/lib/dante/runner.rb
CHANGED
|
@@ -315,13 +315,17 @@ module Dante
|
|
|
315
315
|
begin
|
|
316
316
|
# EXCL: never written through a file or symlink put there since
|
|
317
317
|
File.open(tmp_path, File::WRONLY | File::CREAT | File::EXCL) { |f| f.write("#{pid}\n") }
|
|
318
|
-
rescue Errno::EACCES
|
|
318
|
+
rescue Errno::EACCES => e
|
|
319
319
|
# A pid file made for the daemon's user in a directory it cannot write, as an init
|
|
320
|
-
# script might. Without CREAT, a missing one
|
|
320
|
+
# script might. Without CREAT, a missing one re-raises the original EACCES, as before.
|
|
321
321
|
# ceiling: not atomic, so a reader can see it half-written; giving the daemon's user
|
|
322
322
|
# the directory restores the rename.
|
|
323
323
|
tmp_path = nil
|
|
324
|
-
|
|
324
|
+
begin
|
|
325
|
+
File.open(pid_path, File::WRONLY | File::TRUNC | File::NOFOLLOW) { |f| f.write("#{pid}\n") }
|
|
326
|
+
rescue Errno::ENOENT
|
|
327
|
+
raise e
|
|
328
|
+
end
|
|
325
329
|
return
|
|
326
330
|
end
|
|
327
331
|
File.rename(tmp_path, pid_path)
|
data/lib/dante/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dante
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan Esquenazi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-12-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -45,24 +45,12 @@ executables: []
|
|
|
45
45
|
extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
|
47
47
|
files:
|
|
48
|
-
- ".github/dependabot.yml"
|
|
49
|
-
- ".github/workflows/ci.yml"
|
|
50
|
-
- ".github/workflows/github-release.yml"
|
|
51
|
-
- ".github/workflows/release.yml"
|
|
52
|
-
- ".gitignore"
|
|
53
48
|
- CHANGELOG.md
|
|
54
|
-
- Gemfile
|
|
55
49
|
- LICENSE
|
|
56
50
|
- README.md
|
|
57
|
-
- Rakefile
|
|
58
|
-
- dante.gemspec
|
|
59
51
|
- lib/dante.rb
|
|
60
52
|
- lib/dante/runner.rb
|
|
61
53
|
- lib/dante/version.rb
|
|
62
|
-
- test/dante_test.rb
|
|
63
|
-
- test/runner_test.rb
|
|
64
|
-
- test/test_helper.rb
|
|
65
|
-
- test/user_switch_test.rb
|
|
66
54
|
homepage: https://github.com/nesquena/dante
|
|
67
55
|
licenses:
|
|
68
56
|
- MIT
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/ci.yml
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "master" ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ "master" ]
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
matrix:
|
|
18
|
-
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
|
-
- name: Set up Ruby
|
|
23
|
-
uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
24
|
-
with:
|
|
25
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
26
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
27
|
-
- name: Run tests
|
|
28
|
-
run: bundle exec rake test
|
|
29
|
-
- name: Run the user and group switching tests as root
|
|
30
|
-
run: sudo -E env "PATH=$PATH" bundle exec ruby -Ilib -Itest test/user_switch_test.rb
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Creates the GitHub release page for a tag that already exists, with GitHub's generated notes (merged
|
|
2
|
-
# PRs and new contributors since the previous release) after a link to CHANGELOG.md as of that tag (the
|
|
3
|
-
# default branch's for an old tag that has none).
|
|
4
|
-
# release.yml runs it after it publishes; "Run workflow" here (with the tag) creates the page for an
|
|
5
|
-
# earlier release. A tag that already has a release is left alone, so running it twice is harmless.
|
|
6
|
-
# A tag that isn't the newest vX.Y.Z tag is created with --latest=false; the API otherwise marks every
|
|
7
|
-
# new release as Latest.
|
|
8
|
-
|
|
9
|
-
name: github-release
|
|
10
|
-
run-name: github release ${{ inputs.tag }}
|
|
11
|
-
|
|
12
|
-
on:
|
|
13
|
-
workflow_dispatch:
|
|
14
|
-
inputs:
|
|
15
|
-
tag:
|
|
16
|
-
description: 'An existing tag, e.g. v1.2.0'
|
|
17
|
-
required: true
|
|
18
|
-
type: string
|
|
19
|
-
workflow_call:
|
|
20
|
-
inputs:
|
|
21
|
-
tag:
|
|
22
|
-
required: true
|
|
23
|
-
type: string
|
|
24
|
-
|
|
25
|
-
permissions:
|
|
26
|
-
contents: read
|
|
27
|
-
|
|
28
|
-
jobs:
|
|
29
|
-
release-page:
|
|
30
|
-
if: github.repository == 'nesquena/dante'
|
|
31
|
-
runs-on: ubuntu-latest
|
|
32
|
-
permissions:
|
|
33
|
-
contents: write # creates the release
|
|
34
|
-
steps:
|
|
35
|
-
- name: Create the GitHub release
|
|
36
|
-
shell: bash -eo pipefail {0}
|
|
37
|
-
env:
|
|
38
|
-
TAG: ${{ inputs.tag }}
|
|
39
|
-
CHANGELOG: CHANGELOG.md
|
|
40
|
-
GH_TOKEN: ${{ github.token }}
|
|
41
|
-
run: |
|
|
42
|
-
[[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::'$TAG' is not a tag like v1.2.3"; exit 1; }
|
|
43
|
-
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
|
44
|
-
echo "$TAG already has a release; leaving it alone"
|
|
45
|
-
exit 0
|
|
46
|
-
fi
|
|
47
|
-
# Compare with the newest vX.Y.Z tag rather than the "Latest" release, so a failed lookup stops the
|
|
48
|
-
# step (pipefail) instead of letting an older tag become Latest
|
|
49
|
-
newest=$(gh api --paginate "repos/$GITHUB_REPOSITORY/git/matching-refs/tags/v" --jq '.[].ref' |
|
|
50
|
-
sed -nE 's#^refs/tags/(v[0-9]+\.[0-9]+\.[0-9]+)$#\1#p' | sort -V | tail -n 1) ||
|
|
51
|
-
{ echo "::error::could not list the repository's tags"; exit 1; }
|
|
52
|
-
[ -n "$newest" ] || { echo "::error::found no vX.Y.Z tag (is $TAG pushed?)"; exit 1; }
|
|
53
|
-
flags=()
|
|
54
|
-
if [ "$newest" != "$TAG" ]; then
|
|
55
|
-
echo "$TAG is not the newest tag ($newest): not marking it as latest"
|
|
56
|
-
flags=(--latest=false)
|
|
57
|
-
fi
|
|
58
|
-
# Link the changelog as of the tag, or the default branch's for an old tag without one. Any error
|
|
59
|
-
# but a 404 stops the step.
|
|
60
|
-
ref=$TAG
|
|
61
|
-
if ! err=$(gh api "repos/$GITHUB_REPOSITORY/contents/$CHANGELOG?ref=$TAG" --silent 2>&1 >/dev/null); then
|
|
62
|
-
[[ "$err" == *"HTTP 404"* ]] || { echo "::error::could not look up $CHANGELOG at $TAG: $err"; exit 1; }
|
|
63
|
-
echo "$TAG has no $CHANGELOG; linking the default branch's"
|
|
64
|
-
ref=HEAD
|
|
65
|
-
fi
|
|
66
|
-
# --verify-tag: refuse rather than create the tag. With --generate-notes, GitHub puts these notes
|
|
67
|
-
# before the generated ones.
|
|
68
|
-
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --verify-tag --title "$TAG" --generate-notes "${flags[@]}" \
|
|
69
|
-
--notes "What changed, and what to do when upgrading: [$CHANGELOG](https://github.com/$GITHUB_REPOSITORY/blob/$ref/$CHANGELOG)."
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
# Publishes a dante release to rubygems.org with trusted publishing, gated by the "release"
|
|
2
|
-
# environment: the owner approves each publish.
|
|
3
|
-
#
|
|
4
|
-
# Usual path: merge the release PR (the version in lib/dante/version.rb and the CHANGELOG.md heading
|
|
5
|
-
# stamped with the date, e.g. "## 0.3.0 (2026-11-01)"), then "Run workflow" on master with the
|
|
6
|
-
# version. build checks the version, that the changelog's first heading is that version with a date,
|
|
7
|
-
# and the branch, and builds the gem reproducibly; publish waits for approval, pushes the gem with
|
|
8
|
-
# short-lived trusted-publishing credentials, then creates the tag vX.Y.Z on the built commit. Pushing
|
|
9
|
-
# a vX.Y.Z tag on a master commit runs the same checks. "Re-run failed jobs" (not "Re-run all jobs",
|
|
10
|
-
# which rebuilds) resumes a release that stopped partway.
|
|
11
|
-
# If the gem is pushed but the tag step keeps failing, push the tag by hand at the built commit: that
|
|
12
|
-
# tag push's run skips the push (same sum).
|
|
13
|
-
# Then github-release.yml creates the GitHub release page for the tag (it can also be run by hand for
|
|
14
|
-
# an earlier tag).
|
|
15
|
-
#
|
|
16
|
-
# Dry run: tick dry_run to check the wiring. Everything runs except the changelog checks, the tag, the
|
|
17
|
-
# push and the release page; the credential exchange fails unless the trusted publisher is set up.
|
|
18
|
-
#
|
|
19
|
-
# The "release" environment's protection rules are the ONLY gate on publishing (required reviewer, no
|
|
20
|
-
# admin bypass, deployments only from master and v*.*.* tags): RubyGems trusts any run of this file
|
|
21
|
-
# that uses that environment, and a branch or tag can carry its own modified copy of it. The trusted
|
|
22
|
-
# publisher on rubygems.org must name the environment. Before approving a deployment, check
|
|
23
|
-
# who started the run, the event, that the commit is the release PR's merge commit, and the build
|
|
24
|
-
# log's "is on master" line. Reject any run you won't approve: a waiting run blocks the next one.
|
|
25
|
-
# A deployment rule for X.Y-stable lets anyone with write access create such a branch carrying its own
|
|
26
|
-
# copy of this file: add one only for a maintenance release, and remove it after.
|
|
27
|
-
|
|
28
|
-
name: release
|
|
29
|
-
run-name: release ${{ inputs.version || github.ref_name }}${{ inputs.dry_run && ' (dry run)' || '' }}
|
|
30
|
-
|
|
31
|
-
on:
|
|
32
|
-
push:
|
|
33
|
-
tags: ['v[0-9]+.[0-9]+.[0-9]+']
|
|
34
|
-
workflow_dispatch:
|
|
35
|
-
inputs:
|
|
36
|
-
version:
|
|
37
|
-
description: 'Version to release (already in the version file of this branch), e.g. 1.2.0'
|
|
38
|
-
required: true
|
|
39
|
-
type: string
|
|
40
|
-
dry_run:
|
|
41
|
-
description: 'Dry run: check, build and exchange credentials, but create no tag and push nothing'
|
|
42
|
-
required: false
|
|
43
|
-
type: boolean
|
|
44
|
-
default: false
|
|
45
|
-
|
|
46
|
-
permissions:
|
|
47
|
-
contents: read
|
|
48
|
-
|
|
49
|
-
concurrency:
|
|
50
|
-
group: release
|
|
51
|
-
cancel-in-progress: false
|
|
52
|
-
|
|
53
|
-
jobs:
|
|
54
|
-
build:
|
|
55
|
-
if: github.repository == 'nesquena/dante'
|
|
56
|
-
runs-on: ubuntu-latest
|
|
57
|
-
env:
|
|
58
|
-
TRUNK: master
|
|
59
|
-
TAG_PREFIX: v
|
|
60
|
-
GEMS: 'dante:.'
|
|
61
|
-
VERSION_FILE: lib/dante/version.rb
|
|
62
|
-
CHANGELOG: CHANGELOG.md
|
|
63
|
-
CHANGELOG_HEADING: '^## '
|
|
64
|
-
CHANGELOG_TOP: '^## ([0-9]+\.[0-9]+\.[0-9]+)( |$)'
|
|
65
|
-
outputs:
|
|
66
|
-
version: ${{ steps.check.outputs.version }}
|
|
67
|
-
tag: ${{ steps.check.outputs.tag }}
|
|
68
|
-
steps:
|
|
69
|
-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
70
|
-
with:
|
|
71
|
-
fetch-depth: 0
|
|
72
|
-
submodules: true
|
|
73
|
-
persist-credentials: false
|
|
74
|
-
- uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
75
|
-
with:
|
|
76
|
-
ruby-version: '3.3'
|
|
77
|
-
- name: Check the version
|
|
78
|
-
id: check
|
|
79
|
-
shell: bash -eo pipefail {0}
|
|
80
|
-
env:
|
|
81
|
-
INPUT_VERSION: ${{ inputs.version }}
|
|
82
|
-
DRY_RUN: ${{ inputs.dry_run }}
|
|
83
|
-
run: |
|
|
84
|
-
if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
|
|
85
|
-
version="$INPUT_VERSION"
|
|
86
|
-
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::the version input is not a plain version like 1.2.3"; exit 1; }
|
|
87
|
-
case "$GITHUB_REF" in
|
|
88
|
-
"refs/heads/$TRUNK"|"refs/heads/${version%.*}-stable") ;;
|
|
89
|
-
*) echo "::error::run this on $TRUNK or ${version%.*}-stable, not $GITHUB_REF"; exit 1 ;;
|
|
90
|
-
esac
|
|
91
|
-
tag="$TAG_PREFIX$version"
|
|
92
|
-
tagged=$(git ls-remote origin "refs/tags/$tag*" | awk -v t="refs/tags/$tag" '$2 == t || $2 == t "^{}" { print $1 }')
|
|
93
|
-
[ -z "$tagged" ] || echo "$tagged" | grep -qx "$GITHUB_SHA" ||
|
|
94
|
-
{ echo "::error::tag $tag already exists at another commit"; exit 1; }
|
|
95
|
-
else
|
|
96
|
-
tag="$GITHUB_REF_NAME"
|
|
97
|
-
version="${tag#"$TAG_PREFIX"}"
|
|
98
|
-
[[ "$tag" == "$TAG_PREFIX"* && "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::tag $tag is not ${TAG_PREFIX}X.Y.Z"; exit 1; }
|
|
99
|
-
fi
|
|
100
|
-
file_version=$(ruby -e 'puts File.binread(ENV["VERSION_FILE"])[/\bVERSION\s*=\s*["\x27]([^"\x27]+)/, 1]')
|
|
101
|
-
[ "$version" = "$file_version" ] || { echo "::error::version $version but $VERSION_FILE says $file_version"; exit 1; }
|
|
102
|
-
if [ "$DRY_RUN" = true ]; then
|
|
103
|
-
echo "::warning::dry run: not checking $CHANGELOG"
|
|
104
|
-
else
|
|
105
|
-
heading=$(grep -m1 -E "$CHANGELOG_HEADING" "$CHANGELOG") || { echo "::error::$CHANGELOG has no heading matching '$CHANGELOG_HEADING'"; exit 1; }
|
|
106
|
-
top=$(echo "$heading" | sed -nE "s/$CHANGELOG_TOP.*/\1/p")
|
|
107
|
-
[ "$top" = "$version" ] || { echo "::error::$CHANGELOG starts with '$heading', not release $version: merge the release PR first, and nothing after it"; exit 1; }
|
|
108
|
-
rest="${heading#*"$version"}"
|
|
109
|
-
[[ "$rest" =~ (19|20)[0-9][0-9] ]] && ! echo "$rest" | grep -qiwE 'unreleased|tbd|tba' ||
|
|
110
|
-
{ echo "::error::$CHANGELOG's '$heading' isn't stamped with a date yet"; exit 1; }
|
|
111
|
-
fi
|
|
112
|
-
series="${version%.*}-stable"
|
|
113
|
-
on=""
|
|
114
|
-
for b in "$series" "$TRUNK"; do
|
|
115
|
-
git merge-base --is-ancestor "$GITHUB_SHA" "refs/remotes/origin/$b" 2>/dev/null && on="$b"
|
|
116
|
-
done
|
|
117
|
-
[ -n "$on" ] || { echo "::error::$version ($GITHUB_SHA) is not on $TRUNK or $series"; exit 1; }
|
|
118
|
-
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
119
|
-
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
|
120
|
-
echo "$version ($GITHUB_SHA) is on $on"
|
|
121
|
-
- name: Build the gems
|
|
122
|
-
shell: bash -eo pipefail {0}
|
|
123
|
-
env:
|
|
124
|
-
VERSION: ${{ steps.check.outputs.version }}
|
|
125
|
-
run: |
|
|
126
|
-
SOURCE_DATE_EPOCH=$(git log -1 --format=%ct "$GITHUB_SHA"); export SOURCE_DATE_EPOCH
|
|
127
|
-
mkdir dist
|
|
128
|
-
for spec in $GEMS; do
|
|
129
|
-
g="${spec%%:*}"; dir="${spec#*:}"; [ "$dir" = "$spec" ] && dir=.
|
|
130
|
-
out="$GITHUB_WORKSPACE/dist/$g-$VERSION.gem"
|
|
131
|
-
(cd "$dir" && gem build "$g.gemspec" --output "$out")
|
|
132
|
-
[ "$(gem spec "$out" name)" = "--- $g" ] && [ "$(gem spec "$out" version | sed -n 's/^version: //p')" = "$VERSION" ] ||
|
|
133
|
-
{ echo "::error::$out is not $g $VERSION:"; gem spec "$out" name; gem spec "$out" version; exit 1; }
|
|
134
|
-
echo "$g" >> dist/ORDER
|
|
135
|
-
done
|
|
136
|
-
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH (ruby $(ruby -e 'print RUBY_VERSION'), rubygems $(gem -v))"
|
|
137
|
-
(cd dist && sha256sum *.gem > SHA256SUMS && cat ORDER SHA256SUMS)
|
|
138
|
-
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
139
|
-
with:
|
|
140
|
-
name: gems-${{ steps.check.outputs.version }}
|
|
141
|
-
path: dist/
|
|
142
|
-
if-no-files-found: error
|
|
143
|
-
|
|
144
|
-
publish:
|
|
145
|
-
needs: build
|
|
146
|
-
runs-on: ubuntu-latest
|
|
147
|
-
environment: release
|
|
148
|
-
permissions:
|
|
149
|
-
contents: write # creates the tag on a dispatched release
|
|
150
|
-
id-token: write # the RubyGems trusted-publishing exchange
|
|
151
|
-
steps:
|
|
152
|
-
- name: Refuse a stale run (the tag is somewhere else)
|
|
153
|
-
shell: bash -eo pipefail {0}
|
|
154
|
-
env:
|
|
155
|
-
TAG: ${{ needs.build.outputs.tag }}
|
|
156
|
-
run: |
|
|
157
|
-
tagged=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY" "refs/tags/$TAG*" |
|
|
158
|
-
awk -v t="refs/tags/$TAG" '$2 == t || $2 == t "^{}" { print $1 }')
|
|
159
|
-
if [ -z "$tagged" ] && [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
|
|
160
|
-
echo "tag $TAG will be created at $GITHUB_SHA"
|
|
161
|
-
else
|
|
162
|
-
echo "$tagged" | grep -qx "$GITHUB_SHA" || { echo "::error::tag $TAG is not at $GITHUB_SHA (now: ${tagged:-gone}); this run is stale"; exit 1; }
|
|
163
|
-
fi
|
|
164
|
-
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
165
|
-
with:
|
|
166
|
-
name: gems-${{ needs.build.outputs.version }}
|
|
167
|
-
path: dist
|
|
168
|
-
- name: Check the sums
|
|
169
|
-
working-directory: dist
|
|
170
|
-
run: sha256sum -c SHA256SUMS
|
|
171
|
-
- uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
|
|
172
|
-
with:
|
|
173
|
-
ruby-version: '3.3'
|
|
174
|
-
- uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
|
|
175
|
-
- name: Dry run ends here
|
|
176
|
-
if: inputs.dry_run
|
|
177
|
-
run: echo "Credentials exchange succeeded, so the trusted publisher works. No tag created, nothing pushed."
|
|
178
|
-
- name: Push the gems
|
|
179
|
-
if: ${{ !inputs.dry_run }}
|
|
180
|
-
shell: bash -eo pipefail {0}
|
|
181
|
-
working-directory: dist
|
|
182
|
-
env:
|
|
183
|
-
VERSION: ${{ needs.build.outputs.version }}
|
|
184
|
-
run: |
|
|
185
|
-
while read -r g; do
|
|
186
|
-
sum=$(sha256sum "$g-$VERSION.gem" | cut -d' ' -f1)
|
|
187
|
-
published=$(curl -fsS "https://rubygems.org/api/v1/versions/$g.json" 2>/dev/null |
|
|
188
|
-
ruby -rjson -e 'b = $stdin.read; v = (b.empty? ? [] : JSON.parse(b)).find { |x| x["number"] == ENV["VERSION"] && x["platform"] == "ruby" }; print v ? v["sha"].to_s : ""' || true)
|
|
189
|
-
if [ -z "$published" ]; then
|
|
190
|
-
gem push "$g-$VERSION.gem" </dev/null
|
|
191
|
-
elif [ "$published" = "$sum" ]; then
|
|
192
|
-
echo "$g $VERSION is already on rubygems.org with this sum; skipping"
|
|
193
|
-
else
|
|
194
|
-
echo "::error::$g $VERSION is already on rubygems.org with sha256 $published, not this build's $sum"; exit 1
|
|
195
|
-
fi
|
|
196
|
-
done < ORDER
|
|
197
|
-
- name: Create the tag
|
|
198
|
-
if: github.event_name == 'workflow_dispatch' && !inputs.dry_run
|
|
199
|
-
shell: bash -eo pipefail {0}
|
|
200
|
-
env:
|
|
201
|
-
TAG: ${{ needs.build.outputs.tag }}
|
|
202
|
-
GH_TOKEN: ${{ github.token }}
|
|
203
|
-
run: |
|
|
204
|
-
tagged=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY" "refs/tags/$TAG*" |
|
|
205
|
-
awk -v t="refs/tags/$TAG" '$2 == t || $2 == t "^{}" { print $1 }')
|
|
206
|
-
if [ -z "$tagged" ]; then
|
|
207
|
-
gh api "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/tags/$TAG" -f sha="$GITHUB_SHA"
|
|
208
|
-
elif echo "$tagged" | grep -qx "$GITHUB_SHA"; then
|
|
209
|
-
echo "tag $TAG is already at $GITHUB_SHA"
|
|
210
|
-
else
|
|
211
|
-
echo "::error::tag $TAG is not at $GITHUB_SHA (now: $tagged)"; exit 1
|
|
212
|
-
fi
|
|
213
|
-
|
|
214
|
-
release-page:
|
|
215
|
-
needs: [build, publish]
|
|
216
|
-
if: ${{ !inputs.dry_run }}
|
|
217
|
-
permissions:
|
|
218
|
-
contents: write # github-release.yml creates the release
|
|
219
|
-
uses: ./.github/workflows/github-release.yml
|
|
220
|
-
with:
|
|
221
|
-
tag: ${{ needs.build.outputs.tag }}
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require 'bundler/gem_tasks'
|
|
2
|
-
require 'rake/testtask'
|
|
3
|
-
# require 'yard'
|
|
4
|
-
|
|
5
|
-
TEST_FILES = FileList[File.expand_path('../test/**/*_test.rb', __FILE__)]
|
|
6
|
-
|
|
7
|
-
Rake::TestTask.new do |t|
|
|
8
|
-
t.libs.push "lib"
|
|
9
|
-
t.test_files = TEST_FILES
|
|
10
|
-
t.verbose = true
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Rake::TestTask treats an empty file list as a passing run of nothing.
|
|
14
|
-
task :test_files_present do
|
|
15
|
-
abort "No test files match test/**/*_test.rb" if TEST_FILES.empty?
|
|
16
|
-
end
|
|
17
|
-
task :test => :test_files_present
|
|
18
|
-
|
|
19
|
-
task :default => :test
|
|
20
|
-
|
|
21
|
-
# task :doc do
|
|
22
|
-
# YARD::CLI::Yardoc.new.run
|
|
23
|
-
# end
|
data/dante.gemspec
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
-
require "dante/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |s|
|
|
6
|
-
s.name = "dante"
|
|
7
|
-
s.version = Dante::VERSION
|
|
8
|
-
s.authors = ["Nathan Esquenazi"]
|
|
9
|
-
s.email = ["nesquena@gmail.com"]
|
|
10
|
-
s.homepage = "https://github.com/nesquena/dante"
|
|
11
|
-
s.summary = %q{Turn any process into a demon}
|
|
12
|
-
s.description = %q{Turn any process into a demon.}
|
|
13
|
-
s.license = "MIT"
|
|
14
|
-
s.metadata = {
|
|
15
|
-
"source_code_uri" => "https://github.com/nesquena/dante",
|
|
16
|
-
"changelog_uri" => "https://github.com/nesquena/dante/blob/master/CHANGELOG.md",
|
|
17
|
-
"bug_tracker_uri" => "https://github.com/nesquena/dante/issues",
|
|
18
|
-
"rubygems_mfa_required" => "true"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
s.files = `git ls-files`.split("\n")
|
|
22
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
23
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
24
|
-
s.require_paths = ["lib"]
|
|
25
|
-
s.required_ruby_version = '>= 2.7'
|
|
26
|
-
|
|
27
|
-
s.add_development_dependency 'rake'
|
|
28
|
-
s.add_development_dependency 'minitest', '>= 5.0'
|
|
29
|
-
end
|
data/test/dante_test.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require File.expand_path('../test_helper', __FILE__)
|
|
2
|
-
|
|
3
|
-
describe "dante module" do
|
|
4
|
-
before do
|
|
5
|
-
@process = TestingProcess.new('a', @tmpdir)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "can run jobs using #run method" do
|
|
9
|
-
capture_stdout do
|
|
10
|
-
Dante.run('test-process') { @process.run_a! }
|
|
11
|
-
end
|
|
12
|
-
@output = File.read(@process.tmp_path)
|
|
13
|
-
assert_match(/Started/, @output)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|