Skip to content

Commit

Permalink
Migrate from make to just (#1118)
Browse files Browse the repository at this point in the history
* Migrate from make to just

* address review from socorro repo justfile
  • Loading branch information
relud authored Nov 18, 2024
1 parent d829db9 commit d8e699b
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 179 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
contents: read
deployments: write
id-token: write
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
# Disable docker compose volume mounts in docker-compose.override.yml
COMPOSE_FILE: docker-compose.yml
Expand All @@ -39,24 +39,21 @@ jobs:
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > version.json
- name: Output version.json
run: cat version.json
- name: Install just
run: sudo apt-get update && sudo apt-get install -y just
- name: Build Docker images
run: make build
run: just build
- name: Verify requirements.txt contains correct dependencies
run: |
docker compose run --rm --no-deps test shell ./bin/run_verify_reqs.sh
run: just verify-reqs
- name: Run lint check
run: |
make my.env
docker compose run --rm --no-deps test shell ./bin/run_lint.sh
run: just lint
- name: Run tests
run: |
make my.env
docker compose run --rm test shell ./bin/run_tests.sh
run: just test
- name: Run systemtest
run: |
make setup
docker compose up --detach --wait --wait-timeout=10 web nginx
docker compose run --rm web shell systemtest/test_env.sh local
just setup
just run --detach --wait --wait-timeout=10 web nginx
just shell systemtest/test_env.sh local
- name: Set Docker image tag to "latest" for updates of the main branch
if: github.ref == 'refs/heads/main'
Expand Down
129 changes: 0 additions & 129 deletions Makefile

This file was deleted.

11 changes: 9 additions & 2 deletions bin/run_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ FILES="antenna bin docs testlib tests systemtest"
PYTHON_VERSION=$(python --version)


if [[ "${1:-}" == "--fix" ]]; then
if [[ "${1:-}" == "--help" ]]; then
echo "Usage: $0 [OPTIONS]"
echo
echo " Lint code"
echo
echo "Options:"
echo " --help Show this message and exit."
echo " --fix Reformat code."
elif [[ "${1:-}" == "--fix" ]]; then
echo ">>> ruff fix (${PYTHON_VERSION})"
ruff format $FILES
ruff check --fix $FILES

else
echo ">>> ruff (${PYTHON_VERSION})"
ruff check $FILES
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ services:
build:
context: .
dockerfile: docker/Dockerfile
args:
userid: ${USE_UID:-10001}
groupid: ${USE_GID:-10001}
image: local/antenna_deploy_base

# ------------------------------------------------------------------
Expand Down Expand Up @@ -56,7 +59,7 @@ services:
service: base
env_file:
- docker/config/local_dev.env
- my.env
- .env
command: web
links:
- fakesentry
Expand Down
4 changes: 2 additions & 2 deletions docker/config/my.env.dist → docker/config/.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

# If you want to set the uid and gid of the app user that we use in the
# containers, you can do that with these two variables.
# ANTENNA_UID=
# ANTENNA_GID=
# USE_UID=
# USE_GID=
46 changes: 23 additions & 23 deletions docs/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ is also used for local development of Antenna.
For more comprehensive documentation or instructions on how to set this up in
production, see documentation_.

1. Install required software: Docker, make, and git.
1. Install required software: Docker, just, and git.

2. Clone the repository to your local machine.

Expand All @@ -32,38 +32,38 @@ production, see documentation_.

.. code-block:: shell
$ make my.env
$ just _env
Then edit the file and set the ``ANTENNA_UID`` and ``ANTENNA_GID``
Then edit the ``.env`` file and set the ``USE_UID`` and ``USE_GID``
variables. These will get used when creating the app user in the base image.

If you ever want different values, change them in ``my.env`` and re-run
``make build``.
If you ever want different values, change them in ``.env`` and re-run
``just build``.

4. Download and build Antenna docker containers:

.. code-block:: shell
$ make build
$ just build
Anytime you want to update the containers, you can run ``make build``.
Anytime you want to update the containers, you can run ``just build``.

5. Set up local Pub/Sub and GCS services:

.. code-block:: shell
$ make setup
$ just setup
Anytime you want to wipe service state and recreate them, you can re-run
this make rule.
this just rule.

6. Run with a prod-like fully-functional configuration.

1. Running:

.. code-block:: shell
$ make run
$ just run
You should see a lot of output. It'll start out with something like this::

Expand Down Expand Up @@ -188,15 +188,15 @@ production, see documentation_.

.. code-block:: shell
$ make test
$ just test
If you need to run specific tests or pass in different arguments, you can run
bash in the base container and then run ``pytest`` with whatever args you
want. For example:

.. code-block:: shell
$ make shell
$ just shell
app@...$ pytest
<pytest output>
Expand Down Expand Up @@ -308,15 +308,15 @@ To lint the code:

.. code-block:: shell
$ make lint
$ just lint
If you hit issues, use ``# noqa``.

To reformat the code:

.. code-block:: shell
$ make lintfix
$ just lint --fix
We're using:

Expand Down Expand Up @@ -353,15 +353,15 @@ For example, to add ``foobar`` version 5:

.. code-block:: shell
make rebuildreqs
just rebuild-reqs
to apply the updates to ``requirements.txt``

3. rebuild your docker environment:

.. code-block:: shell
$ make build
$ just build
If there are problems, it'll tell you.

Expand All @@ -370,7 +370,7 @@ dependencies. To do this, run:

.. code-block:: shell
$ make updatereqs
$ just rebuild-reqs --update
Documentation
Expand All @@ -384,7 +384,7 @@ To build the docs, run this:

.. code-block:: shell
$ make docs
$ just docs
Testing
Expand All @@ -394,7 +394,7 @@ To run the tests, run this:

.. code-block:: shell
$ make test
$ just test
Tests go in ``tests/``. Data required by tests goes in ``tests/data/``.
Expand All @@ -405,7 +405,7 @@ For example:

.. code-block:: shell
$ make shell
$ just shell
app@...$ pytest
<pytest output>
Expand All @@ -429,7 +429,7 @@ development instance. There are a few options:

.. code-block:: bash
$ make shell
$ just shell
app@c392a11dbfec:/app$ python -m testlib.mini_poster --url URL
2. Use Firefox and set the ``MOZ_CRASHREPORTER_URL`` environment variable:
Expand Down Expand Up @@ -514,7 +514,7 @@ first run:

.. code-block:: shell
$ make devcontainerbuild
$ just build devcontainer
Additionally on mac there is the potential that running git from inside any
container that mounts the current directory to `/app`, such as the development
Expand All @@ -534,7 +534,7 @@ pick up changes:

.. code-block:: shell
$ make devcontainer
$ just run -d devcontainer
Upgrading to a new Python version
Expand Down
Loading

0 comments on commit d8e699b

Please sign in to comment.