From 67a1c43d1c5ae5757b7174ebc7232bd5952ce0de Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Mon, 25 Jul 2022 07:54:28 +0200 Subject: [PATCH 1/2] Add workflow to test the action --- .github/workflows/test-iamlive-action.yaml | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/test-iamlive-action.yaml diff --git a/.github/workflows/test-iamlive-action.yaml b/.github/workflows/test-iamlive-action.yaml new file mode 100644 index 0000000..684cbb1 --- /dev/null +++ b/.github/workflows/test-iamlive-action.yaml @@ -0,0 +1,57 @@ +name: Test iamlive action +on: + push: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + check-dist: + name: Check dist + runs-on: ubuntu-22.04 + + permissions: + contents: read + + steps: + - name: Check out code + uses: actions/checkout@v3.0.2 + + - name: Check diff is up to date + run: | + git diff --quiet -- dist || { + echo "::error::The ./dist is outdated, run 'yarn build' and commit" + exit 1 + } + + utilize: + name: Use iamlive action + runs-on: ubuntu-22.04 + + needs: [check-dist] + + permissions: + contents: read + + steps: + - name: Check out code + uses: actions/checkout@v3.0.2 + + - name: Setup Node + uses: actions/setup-node@v3.4.1 + with: + node-version: '16' + + - name: Setup iamlive + id: setup-iamlive + uses: ./ + with: + iamlive-version: v0.48.0 + + - name: Check output and installPath + run: | + [ "${IAMLIVE_VERSION}" == v0.48.0 ] || { echo >&2 "::error::Expected v0.48.0 to be installed."; } + hash iamlive 2>/dev/null || { echo >&2 "iamlive can not be found in the PATH."; exit 1; } + + echo "::notice::Installed iamlive ${IAMLIVE_VERSION} at $(which iamlive)" + env: + IAMLIVE_VERSION: ${{ steps.setup-iamlive.outputs.iamlive-version }} From bb04bac52ac7f29851a93d5c468ca9133083e87d Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Mon, 25 Jul 2022 07:56:45 +0200 Subject: [PATCH 2/2] Add act to test workflows locally --- .actrc | 5 +++++ package.json | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .actrc diff --git a/.actrc b/.actrc new file mode 100644 index 0000000..bf4049f --- /dev/null +++ b/.actrc @@ -0,0 +1,5 @@ +-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest +-P ubuntu-22.04=ghcr.io/catthehacker/ubuntu:act-22.04 +-P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04 +-P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04 +-P self-hosted=ghcr.io/catthehacker/ubuntu:act-22.04 diff --git a/package.json b/package.json index 8886dc0..e2c72a5 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "license": "MIT", "scripts": { "build": "ncc build -m -s --license licenses.txt", - "build:watch": "ncc build -m -s --license licenses.txt -w" + "build:watch": "ncc build -m -s --license licenses.txt -w", + "test-run": "act" }, "dependencies": { "@actions/core": "^1.9.0",