diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a0f89d1..862b6e4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,6 +9,10 @@ on: - cron: '0 9 * * *' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: test: @@ -20,7 +24,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 with: - submodules: recursive fetch-depth: 0 - name: Install dependencies @@ -41,8 +44,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 - with: - submodules: recursive - name: Build documentation run: | diff --git a/.gitignore b/.gitignore index feeaf02..93adc24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .DS_Store +/.local +/scripts/Pipfile.lock .build .netrc .swiftpm/config/registries.json diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 73445c4..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "scripts/changes"] - path = scripts/changes - url = https://github.com/jbmorley/changes.git diff --git a/scripts/Pipfile b/scripts/Pipfile new file mode 100644 index 0000000..70010d7 --- /dev/null +++ b/scripts/Pipfile @@ -0,0 +1,13 @@ +[[source]] + +name = "pypi" +url = "https://pypi.python.org/simple" +verify_ssl = true + +[packages] + +changes-semver = "==6.*" + +[requires] + +python_version = "3.12" diff --git a/scripts/changes b/scripts/changes deleted file mode 160000 index 12a6b90..0000000 --- a/scripts/changes +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 12a6b90b2e9699970b199d622437c7fd0b6b81dd diff --git a/scripts/environment.sh b/scripts/environment.sh index 35660c3..ebd0367 100755 --- a/scripts/environment.sh +++ b/scripts/environment.sh @@ -25,12 +25,17 @@ SCRIPTS_DIRECTORY="$ROOT_DIRECTORY/scripts" export LOCAL_TOOLS_PATH="$ROOT_DIRECTORY/.local" -export BIN_DIRECTORY="$ROOT_DIRECTORY/.local/bin" -export PATH=$BIN_DIRECTORY:$PATH +# Keep Python user installs local to the project instead of polluting the host. +export PYTHONUSERBASE="$LOCAL_TOOLS_PATH/python" +mkdir -p "$PYTHONUSERBASE" +export PATH="$PYTHONUSERBASE/bin":$PATH -source "$LOCAL_TOOLS_PATH/python/bin/activate" - -export PIPENV_VENV_IN_PROJECT=1 +# Keep pipenv virtualenvs local and predictable. +export WORKON_HOME="$LOCAL_TOOLS_PATH" +export PIPENV_CUSTOM_VENV_NAME="venv" +export PIPENV_VENV_IN_PROJECT=0 export PIPENV_IGNORE_VIRTUALENVS=1 +export PIPENV_PIPFILE="$SCRIPTS_DIRECTORY/Pipfile" -export PATH=$PATH:"$SCRIPTS_DIRECTORY/changes" +# Add the tools to the path. +export PATH="$LOCAL_TOOLS_PATH/venv/bin":$PATH diff --git a/scripts/gh-release.sh b/scripts/gh-release.sh new file mode 100755 index 0000000..5c956d5 --- /dev/null +++ b/scripts/gh-release.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copyright (c) 2022-2026 Jason Morley +# +# 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. + +set -e +set -o pipefail +set -x + +# Actually make the release. +gh release create "$CHANGES_TAG" --title "$CHANGES_QUALIFIED_TITLE" --notes-file "$CHANGES_NOTES_FILE" + +# Upload the attachments. +for attachment in "$@" +do + gh release upload "$CHANGES_TAG" "$attachment" +done diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index db66820..f3945c3 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -29,8 +29,6 @@ ROOT_DIRECTORY="$( cd "$( dirname "$( dirname "${BASH_SOURCE[0]}" )" )" &> /dev/ SCRIPTS_DIRECTORY="$ROOT_DIRECTORY/scripts" LOCAL_TOOLS_PATH="$ROOT_DIRECTORY/.local" -CHANGES_DIRECTORY="$SCRIPTS_DIRECTORY/changes" -BUILD_TOOLS_DIRECTORY="$SCRIPTS_DIRECTORY/build-tools" # Install tools defined in `.tool-versions`. cd "$ROOT_DIRECTORY" @@ -42,12 +40,9 @@ if [ -d "$LOCAL_TOOLS_PATH" ] ; then fi mkdir -p "$LOCAL_TOOLS_PATH" -# Set up a Python venv to bootstrap our python dependency on `pipenv`. -python -m venv "$LOCAL_TOOLS_PATH/python" - # Source `environment.sh` to ensure the remainder of our paths are set up correctly. source "$SCRIPTS_DIRECTORY/environment.sh" -# Install the Python dependencies. -pip install --upgrade pip pipenv wheel certifi -PIPENV_PIPFILE="$CHANGES_DIRECTORY/Pipfile" pipenv install +# Install the Python dependencies (uses PIPENV_PIPFILE from environment.sh). +pip install --user --ignore-installed --upgrade pip pipenv wheel certifi +pipenv install diff --git a/scripts/release.sh b/scripts/release.sh index 3d027f2..bd725f5 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -22,9 +22,7 @@ SCRIPTS_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" ROOT_DIRECTORY="${SCRIPTS_DIRECTORY}/.." -CHANGES_DIRECTORY="${SCRIPTS_DIRECTORY}/changes" -CHANGES_SCRIPT="${CHANGES_DIRECTORY}/changes" -RELEASE_SCRIPT="${CHANGES_DIRECTORY}/examples/gh-release.sh" +RELEASE_SCRIPT="${SCRIPTS_DIRECTORY}/gh-release.sh" source "${SCRIPTS_DIRECTORY}/environment.sh"