From b00eb4fc4b09f484269e2e0a65342efe0c3c45f3 Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Wed, 22 May 2024 14:18:20 +0200 Subject: [PATCH] =?UTF-8?q?Switch=20to=20new=20=CE=BCpkg=20package=20forma?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 20 ++++++++++++++++++++ .github/workflows/test.yaml | 29 +++++++++++++++++------------ .gitignore | 1 + LICENSE | 21 +++++++++++++++++++++ README.md | 6 +----- test.bats => trap.bats | 5 ++--- upkg.json | 2 +- 7 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .gitignore create mode 100644 LICENSE rename test.bats => trap.bats (92%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..9f596aa --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9b1a472..0bd8a46 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,18 +18,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() diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2ef777e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/results.tap diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3aa6d81 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md index bbab313..fb95195 100644 --- a/README.md +++ b/README.md @@ -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@ -``` +See [the latest release](https://github.com/orbit-online/trap.sh/releases/latest) for instructions. ## Usage diff --git a/test.bats b/trap.bats similarity index 92% rename from test.bats rename to trap.bats index fe3c41c..9bf2fe2 100644 --- a/test.bats +++ b/trap.bats @@ -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 diff --git a/upkg.json b/upkg.json index 231a948..e3f7842 100644 --- a/upkg.json +++ b/upkg.json @@ -1,3 +1,3 @@ { - "assets": ["trap.sh"] + "name": "trap.sh" }