Skip to content

Commit

Permalink
Switch to new μpkg package format
Browse files Browse the repository at this point in the history
  • Loading branch information
andsens committed May 22, 2024
1 parent e98a23c commit bd0bcc9
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 23 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release

on:
push:
tags: ['v*']

jobs:
test:
uses: ./.github/workflows/test.yaml
secrets: inherit
release:
needs: [test]
permissions:
contents: write
runs-on: ubuntu-latest
name: Create GitHub release
steps:
- uses: orbit-online/upkg-release@v1
with:
paths: trap.sh LICENSE README.md
34 changes: 20 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Test

on:
push:
branches: [ '*' ]
tags: [ 'v*' ]
branches: ['*']
tags: ['!v*']
workflow_call: {}

jobs:
lint:
Expand All @@ -18,18 +19,23 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Setup BATS
run: |
git clone --depth 1 --branch v1.10.0 https://github.com/bats-core/bats-core.git /tmp/bats
sudo /tmp/bats/install.sh /usr/local
rm -rf /tmp/bats
sudo mkdir -p /usr/lib/bats/bats-support /usr/lib/bats/bats-assert
wget -O- 'https://github.com/ztombol/bats-support/archive/refs/tags/v0.3.0.tar.gz' | \
sudo tar -xz --strip-components=1 -C /usr/lib/bats/bats-support
wget -O- 'https://github.com/ztombol/bats-assert/archive/refs/tags/v0.3.0.tar.gz' | \
sudo tar -xz --strip-components=1 -C /usr/lib/bats/bats-assert
- name: Install bats
uses: bats-core/bats-action@2.0.0
with:
support-path: ${{ github.workspace }}/lib/bats-support
assert-path: ${{ github.workspace }}/lib/bats-assert
- name: Checkout
uses: actions/checkout@v4
- uses: orbit-online/upkg@v0.14.0
with:
path: trap.sh
- name: Run tests
run: bats .
run: bats --formatter tap13 . | tee results.tap
working-directory: trap.sh
env:
BATS_LIB_PATH: ${{ github.workspace }}/lib
- name: Generate test summary
uses: test-summary/action@v2
with:
paths: trap.sh/results.tap
show: "fail, skip"
if: always()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/results.tap
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Orbit Online A/S

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ Library for managing bash signal traps.

## Installation

With [μpkg](https://github.com/orbit-online/upkg)

```
upkg install -g orbit-online/trap.sh@<VERSION>
```
See [the latest release](https://github.com/orbit-online/trap.sh/releases/latest) for instructions.

## Usage

Expand Down
5 changes: 2 additions & 3 deletions test.bats → trap.bats
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bats
# shellcheck disable=2030,2031

load '/usr/lib/bats/bats-support/load'
load '/usr/lib/bats/bats-assert/load'
bats_load_library bats-support
bats_load_library bats-assert

setup_file() {
bats_require_minimum_version 1.5.0
Expand Down
2 changes: 1 addition & 1 deletion upkg.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"assets": ["trap.sh"]
"name": "trap.sh"
}

0 comments on commit bd0bcc9

Please sign in to comment.