Skip to content

Commit

Permalink
moving all over to ghcr and modernizing vscode settings (OpenCyphal#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
thirtytwobits authored Mar 16, 2023
1 parent 82f8b8b commit 712ee2c
Show file tree
Hide file tree
Showing 11 changed files with 160 additions and 305 deletions.
81 changes: 33 additions & 48 deletions .github/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ def _make_parser() -> argparse.ArgumentParser:
platform: native32
toolchain-family: gcc
"""[
1:
]
),
"""[1:]),
)

build_args = parser.add_argument_group(
Expand All @@ -76,10 +73,7 @@ def _make_parser() -> argparse.ArgumentParser:
"""
Arguments that can be used in parallel builds. Each of these will change
the name of the build directory created for the build.
"""[
1:
]
),
"""[1:]),
)

build_args.add_argument(
Expand All @@ -93,10 +87,7 @@ def _make_parser() -> argparse.ArgumentParser:
export NUNAVUT_FULL_VERSION=$(./_verify.py --version-only)
"""[
1:
]
),
"""[1:]),
)

build_args.add_argument(
Expand All @@ -110,10 +101,19 @@ def _make_parser() -> argparse.ArgumentParser:
export NUNAVUT_MAJOR_MINOR_VERSION=$(./_verify.py --major-minor-version-only)
"""[
1:
]
),
"""[1:]),
)

build_args.add_argument(
"--version-check-only",
help=textwrap.dedent(
"""
Compares a given semantic version number with the current Nunavut version
(stored in src/nunavut/_version.py) and returns 0 if it matches else returns 1.
if $(./_verify.py --version-check-only 1.0.2); then echo "match"; fi
"""[1:]),
)

build_args.add_argument("-l", "--language", default="c", help="Value for NUNAVUT_VERIFICATION_LANG (defaults to c)")
Expand Down Expand Up @@ -148,10 +148,7 @@ def _make_parser() -> argparse.ArgumentParser:
"""
Select the toolchain family to use. Use "none" to get the toolchain
from the environment (i.e. set CC and CXX environment variables).
"""[
1:
]
),
"""[1:]),
)

build_args.add_argument(
Expand All @@ -161,21 +158,15 @@ def _make_parser() -> argparse.ArgumentParser:
"""
Dummy argument used to support matrix builds where an argument present
in other builds is not provided in the current build.
"""[
1:
]
),
"""[1:]),
)

action_args = parser.add_argument_group(
title="behavioral options",
description=textwrap.dedent(
"""
Arguments that change the actions taken by the build.
"""[
1:
]
),
"""[1:]),
)

action_args.add_argument("-v", "--verbose", action="count", default=0, help="Set output verbosity.")
Expand All @@ -190,10 +181,7 @@ def _make_parser() -> argparse.ArgumentParser:
** WARNING ** This will delete the cmake build directory!
"""[
1:
]
),
"""[1:]),
)

action_args.add_argument("-c", "--configure-only", action="store_true", help="Configure but do not build.")
Expand All @@ -213,10 +201,7 @@ def _make_parser() -> argparse.ArgumentParser:
"""
Don't actually do anything. Just log what this script would have done.
Combine with --verbose to ensure you actually see the script's log output.
"""[
1:
]
),
"""[1:]),
)

action_args.add_argument(
Expand All @@ -237,21 +222,15 @@ def _make_parser() -> argparse.ArgumentParser:
Note: This only applies to the configure step. If you do a build-only this
argument has no effect.
"""[
1:
]
),
"""[1:]),
)

other_options = parser.add_argument_group(
title="extra build options",
description=textwrap.dedent(
"""
Additional arguments for modifying how the build runs but which are used less frequently.
"""[
1:
]
),
"""[1:]),
)

other_options.add_argument(
Expand All @@ -271,10 +250,7 @@ def _make_parser() -> argparse.ArgumentParser:
"""
We use Ninja by default. Set this flag to omit the explicit generator override
and use whatever the default is for cmake (i.e. normally make)
"""[
1:
]
),
"""[1:]),
)

return parser
Expand Down Expand Up @@ -575,6 +551,15 @@ def main() -> int:

logging.basicConfig(format="%(levelname)s: %(message)s", level=logging_level)

if args.version_check_only is not None:
version_as_string = ".".join(_get_version_string())
logging.debug(
"Comparing nunavut version {} to provided version {} ({})".format(
version_as_string,
args.version_check_only,
"matches" if (version_as_string == args.version_check_only) else "no-match"))
return 0 if (version_as_string == args.version_check_only) else 1

logging.debug(
textwrap.dedent(
"""
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release to Pypi

on:
release:
types: [ published ]

jobs:
release:
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toxic:ts20.4.1
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: version-check
# Fails the release if the release-tag doesn't match the Nunavut version at that tag.
run: |
$(./.github/verify.py -vv --version-check-only "${{ steps.process_event.outputs.tag }}")
- name: install-tox
run: pip3 install tox
- name: lint
run: tox -e lint
- name: test-nnvg
run: tox -e py310-nnvg
- name: test-doctest
run: tox -e py310-doctest,py310-rstdoctest
- name: test-pytest
run: tox -e py310-test
- name: package
run: tox -e package
- name: upload
run: |
pip3 install twine
twine upload -u __token__ -p ${{ secrets.PYPI_PASSWORD }} .tox/package/dist/*
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
language-verification-c:
runs-on: ubuntu-latest
needs: test
container: uavcan/c_cpp:ubuntu-20.04
container: ghcr.io/opencyphal/toolshed:ts22.4.1
strategy:
matrix:
build_type: [Debug, Release, MinSizeRel]
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
language-verification-cpp-14:
runs-on: ubuntu-latest
needs: test
container: uavcan/c_cpp:ubuntu-20.04
container: ghcr.io/opencyphal/toolshed:ts22.4.1
strategy:
matrix:
build_type: [Debug, Release, MinSizeRel]
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
language-verification-cpp-17:
runs-on: ubuntu-latest
needs: test
container: uavcan/c_cpp:ubuntu-20.04
container: ghcr.io/opencyphal/toolshed:ts22.4.1
strategy:
matrix:
build_type: [Debug, Release, MinSizeRel]
Expand Down Expand Up @@ -220,21 +220,3 @@ jobs:
--toolchain-family ${{ matrix.compiler }} \
--endianness ${{ matrix.endianness }} \
${{ matrix.flag }}
release:
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository == 'OpenCyphal/nunavut' }}
runs-on: ubuntu-latest
needs: [compat-test-python3, language-verification-cpp-14, language-verification-cpp-17, language-verification-c, sonar]
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: download-package
uses: actions/download-artifact@v3
with:
name: pypi-package
path: .tox/package/dist/
- name: upload
run: |
pip3 install twine
twine upload -u __token__ -p ${{ secrets.PYPI_PASSWORD }} .tox/package/dist/*
111 changes: 0 additions & 111 deletions .vscode/c_cpp_properties.json

This file was deleted.

Loading

0 comments on commit 712ee2c

Please sign in to comment.