diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 08f0a72..5ec0fa7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,9 +1,9 @@ -name: Release - -on: - release: - types: [published] - -jobs: - Tag: - uses: secondlife/update-major-tag-workflow/.github/workflows/update-major-tag.yaml@v1 +name: Release + +on: + release: + types: [published] + +jobs: + Tag: + uses: secondlife/update-major-tag-workflow/.github/workflows/update-major-tag.yaml@v1 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6bd9311..0035fae 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,21 +1,21 @@ -name: Test - -on: - pull_request: - push: - branches: [main] - tags: [v*] - -jobs: - test: - strategy: - matrix: - os: [windows-2022, macos-latest, ubuntu-latest] - runs-on: ${{ matrix.os }} - env: - AUTOBUILD_CONFIGURATION: default - steps: - - uses: actions/checkout@v3 - - uses: ./ - with: - checkout: false +name: Test + +on: + pull_request: + push: + branches: [main] + tags: [v*] + +jobs: + test: + strategy: + matrix: + os: [windows-2022, macos-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + env: + AUTOBUILD_CONFIGURATION: default + steps: + - uses: actions/checkout@v3 + - uses: ./ + with: + checkout: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 87b43b8..743e264 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 - hooks: - # Fix the last lines' trailing whitespace before correcting that they exist. - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + # Fix the last lines' trailing whitespace before correcting that they exist. + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml diff --git a/LICENSE b/LICENSE index 59c5a8a..46f0b46 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ -Copyright 2022 Linden Research, Inc. - -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. +Copyright 2022 Linden Research, Inc. + +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 784ade8..86d9ac5 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ -# action-autobuild - -Build and package an autobuild project. - -Example: -```yaml -name: Build - -on: - pull_request: - tag: - branches: [main] - tags: [v*] - -jobs: - build: - strategy: - matrix: - os: [windows-2019, macos-11, ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: secondlife/autobuild@v1 -``` - -For a full list of available action inputs see [action.yaml](action.yaml). +# action-autobuild + +Build and package an autobuild project. + +Example: +```yaml +name: Build + +on: + pull_request: + tag: + branches: [main] + tags: [v*] + +jobs: + build: + strategy: + matrix: + os: [windows-2019, macos-11, ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: secondlife/autobuild@v1 +``` + +For a full list of available action inputs see [action.yaml](action.yaml). diff --git a/action.yaml b/action.yaml index b77c565..9e826ed 100644 --- a/action.yaml +++ b/action.yaml @@ -1,144 +1,144 @@ -name: Autobuild -description: Build and package an autobuild project - -inputs: - checkout: - type: boolean - description: Perform git checkout - default: true - checkout-build-variables: - type: boolean - description: Perform git checkout of build-variables - default: true - setup-python: - type: boolean - description: Install python using actions/python - default: true - setup-autobuild: - type: boolean - description: Install autobuild using secondlife/setup-autobuild - default: true - configure-args: - type: string - description: Additional arguments passed to autobuild configure - build-args: - type: string - description: Additional arguments passed to autobuild build - addrsize: - type: string - description: AUTOBUILD_ADDRSIZE - default: "64" - build-variables-ref: - type: string - description: build-variables repository ref - default: master - release: - type: boolean - description: Upload package to new or existing GitHub release - default: false - -outputs: - package-name: - value: ${{ steps.autobuild.outputs.package_name }} - package-filename: - value: ${{ steps.autobuild.outputs.package_filename }} - package-basename: - value: ${{ steps.autobuild.outputs.package_basename }} - package-md5: - value: ${{ steps.autobuild.outputs.package_md5 }} - -runs: - using: composite - steps: - - name: Checkout - uses: actions/checkout@v3 - if: inputs.checkout - with: - fetch-depth: 0 # checkout full history for autobuild SCM version discovery - - - name: Checkout build variables - uses: actions/checkout@v3 - if: inputs.checkout-build-variables - with: - repository: secondlife/build-variables - ref: ${{ inputs.build-variables-ref }} - path: .build-variables - - - name: Setup python - uses: actions/setup-python@v4 - if: inputs.setup-python - with: - python-version: 3.x - - - name: Setup autobuild - uses: secondlife/setup-autobuild@v1 - if: inputs.setup-autobuild - - - name: Cache installables - uses: actions/cache@v3 - id: cache-installables - with: - path: ${{ github.workspace }}/.autobuild-installables - key: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.configuration }}-${{ hashFiles('autobuild.xml') }} - - - name: Run autobuild - shell: bash - id: autobuild - env: - AUTOBUILD_VARIABLES_FILE: ${{ github.workspace }}/.build-variables/variables - AUTOBUILD_INSTALLABLE_CACHE: ${{ github.workspace }}/.autobuild-installables - AUTOBUILD_ADDRSIZE: ${{ inputs.addrsize }} - run: | - autobuild configure ${{ inputs.configure-args }} - autobuild build --no-configure ${{ inputs.build-args }} - autobuild package --results-file results.txt - . results.txt - - package_basename="$(basename $autobuild_package_filename)" - - # Set outputs - echo "::set-output name=package_name::$autobuild_package_name" - echo "::set-output name=package_filename::$autobuild_package_filename" - echo "::set-output name=package_basename::$package_basename" - echo "::set-output name=package_md5::$autobuild_package_md5" - - - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.autobuild.outputs.package_basename }} - path: ${{ steps.autobuild.outputs.package_filename }} - - - uses: secondlife-3p/release-action@v1 - if: ${{ fromJSON(inputs.release) }} - with: - artifacts: ${{ steps.autobuild.outputs.package_filename }} - omitBodyDuringUpdate: true - allowUpdates: true - - - name: Write summary - shell: bash - env: - PACKAGE_BASENAME: ${{ steps.autobuild.outputs.package_basename }} - PACKAGE_NAME: ${{ steps.autobuild.outputs.package_name }} - PACKAGE_HASH: ${{ steps.autobuild.outputs.package_md5 }} - HOMEPAGE: ${{ github.server_url }}/${{ github.repository }} - RELEASE: ${{ fromJSON(inputs.release) }} - run: | - echo "### Autobuild results: $PACKAGE_NAME" >> $GITHUB_STEP_SUMMARY - echo '| | |' >> $GITHUB_STEP_SUMMARY - echo '|-|-|' >> $GITHUB_STEP_SUMMARY - echo "|file |$PACKAGE_BASENAME|" >> $GITHUB_STEP_SUMMARY - echo "|md5 |$PACKAGE_HASH|" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - if [[ $RELEASE == 'true' ]]; then - VERSION="${GITHUB_REF#refs/*/}" - RELEASE_URL="$HOMEPAGE/releases/tag/$VERSION" - PACKAGE_URL="$HOMEPAGE/releases/download/$VERSION/$PACKAGE_BASENAME" - echo "#### :dizzy: Release info" >> $GITHUB_STEP_SUMMARY - echo "This build has been published as [$VERSION]($RELEASE_URL)." >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "Add as a new dependency:" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo "autobuild installables add $PACKAGE_NAME url=$PACKAGE_URL hash=$PACKAGE_HASH" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - fi +name: Autobuild +description: Build and package an autobuild project + +inputs: + checkout: + type: boolean + description: Perform git checkout + default: true + checkout-build-variables: + type: boolean + description: Perform git checkout of build-variables + default: true + setup-python: + type: boolean + description: Install python using actions/python + default: true + setup-autobuild: + type: boolean + description: Install autobuild using secondlife/setup-autobuild + default: true + configure-args: + type: string + description: Additional arguments passed to autobuild configure + build-args: + type: string + description: Additional arguments passed to autobuild build + addrsize: + type: string + description: AUTOBUILD_ADDRSIZE + default: "64" + build-variables-ref: + type: string + description: build-variables repository ref + default: master + release: + type: boolean + description: Upload package to new or existing GitHub release + default: false + +outputs: + package-name: + value: ${{ steps.autobuild.outputs.package_name }} + package-filename: + value: ${{ steps.autobuild.outputs.package_filename }} + package-basename: + value: ${{ steps.autobuild.outputs.package_basename }} + package-md5: + value: ${{ steps.autobuild.outputs.package_md5 }} + +runs: + using: composite + steps: + - name: Checkout + uses: actions/checkout@v3 + if: inputs.checkout + with: + fetch-depth: 0 # checkout full history for autobuild SCM version discovery + + - name: Checkout build variables + uses: actions/checkout@v3 + if: inputs.checkout-build-variables + with: + repository: secondlife/build-variables + ref: ${{ inputs.build-variables-ref }} + path: .build-variables + + - name: Setup python + uses: actions/setup-python@v4 + if: inputs.setup-python + with: + python-version: 3.x + + - name: Setup autobuild + uses: secondlife/setup-autobuild@v1 + if: inputs.setup-autobuild + + - name: Cache installables + uses: actions/cache@v3 + id: cache-installables + with: + path: ${{ github.workspace }}/.autobuild-installables + key: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.configuration }}-${{ hashFiles('autobuild.xml') }} + + - name: Run autobuild + shell: bash + id: autobuild + env: + AUTOBUILD_VARIABLES_FILE: ${{ github.workspace }}/.build-variables/variables + AUTOBUILD_INSTALLABLE_CACHE: ${{ github.workspace }}/.autobuild-installables + AUTOBUILD_ADDRSIZE: ${{ inputs.addrsize }} + run: | + autobuild configure ${{ inputs.configure-args }} + autobuild build --no-configure ${{ inputs.build-args }} + autobuild package --results-file results.txt + . results.txt + + package_basename="$(basename $autobuild_package_filename)" + + # Set outputs + echo "::set-output name=package_name::$autobuild_package_name" + echo "::set-output name=package_filename::$autobuild_package_filename" + echo "::set-output name=package_basename::$package_basename" + echo "::set-output name=package_md5::$autobuild_package_md5" + + - uses: actions/upload-artifact@v3 + with: + name: ${{ steps.autobuild.outputs.package_basename }} + path: ${{ steps.autobuild.outputs.package_filename }} + + - uses: secondlife-3p/release-action@v1 + if: ${{ fromJSON(inputs.release) }} + with: + artifacts: ${{ steps.autobuild.outputs.package_filename }} + omitBodyDuringUpdate: true + allowUpdates: true + + - name: Write summary + shell: bash + env: + PACKAGE_BASENAME: ${{ steps.autobuild.outputs.package_basename }} + PACKAGE_NAME: ${{ steps.autobuild.outputs.package_name }} + PACKAGE_HASH: ${{ steps.autobuild.outputs.package_md5 }} + HOMEPAGE: ${{ github.server_url }}/${{ github.repository }} + RELEASE: ${{ fromJSON(inputs.release) }} + run: | + echo "### Autobuild results: $PACKAGE_NAME" >> $GITHUB_STEP_SUMMARY + echo '| | |' >> $GITHUB_STEP_SUMMARY + echo '|-|-|' >> $GITHUB_STEP_SUMMARY + echo "|file |$PACKAGE_BASENAME|" >> $GITHUB_STEP_SUMMARY + echo "|md5 |$PACKAGE_HASH|" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + if [[ $RELEASE == 'true' ]]; then + VERSION="${GITHUB_REF#refs/*/}" + RELEASE_URL="$HOMEPAGE/releases/tag/$VERSION" + PACKAGE_URL="$HOMEPAGE/releases/download/$VERSION/$PACKAGE_BASENAME" + echo "#### :dizzy: Release info" >> $GITHUB_STEP_SUMMARY + echo "This build has been published as [$VERSION]($RELEASE_URL)." >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Add as a new dependency:" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "autobuild installables add $PACKAGE_NAME url=$PACKAGE_URL hash=$PACKAGE_HASH" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + fi