Skip to content

Commit

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

* More project admin

* Update README and package dependencies for OpenAPI generation

* Refactor CI workflows to use 'just' for command execution and improve cleanup process in justfile

* Update CI workflow to enable Prometheus and streamline API integration test execution

* Add API_ENDPOINT environment variable for API integration tests

* Increase sleep duration in justfile for better container startup synchronization

* Increase sleep duration in justfile to improve container startup synchronization

* Refactor justfile to improve container startup synchronization by adjusting sleep intervals

* Adjust sleep durations in justfile for improved container startup synchronization

* Increase sleep duration in CI workflow for improved API test reliability

* Reduce sleep durations in CI workflow and justfile for improved efficiency

* Increase sleep durations in CI workflow and justfile for improved stability

* Timing tweaks

* Update devcontainer configuration to use 'just install' for post-creation setup

* Missing reference in monitor edit/new screen

* Fix lint
  • Loading branch information
benc-uk authored Dec 14, 2024
1 parent 2f4d23d commit c678711
Show file tree
Hide file tree
Showing 19 changed files with 354 additions and 415 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
},
"ghcr.io/devcontainers-contrib/features/k6": {},
"ghcr.io/devcontainers/features/docker-in-docker": {},
"ghcr.io/frntn/devcontainers-features/newman": {}
"ghcr.io/guiyomh/features/just:0": {}
},
"postCreateCommand": "sudo apt clean && sudo apt update && sudo apt install -yq figlet",
"postCreateCommand": "just install",
"forwardPorts": [8000, 3000],
"customizations": {
"vscode": {
"settings": {
Expand Down
17 changes: 11 additions & 6 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# ### Version details
BUILD_INFO=Running locally
# Version details
BUILD_INFO="Local dev build"
VERSION=local

# ### MongoDB
# Used when building/pushing the container images
IMAGE_TAG=dev
IMAGE_REG=ghcr.io
IMAGE_NAME=benc-uk/nanomon

# MongoDB
MONGO_URI=mongodb://localhost:27017

# ### For running locally
# For running locally
API_ENDPOINT=http://localhost:8000/api

# ### OPTIONAL: Enable authentication & login
# OPTIONAL: Enable authentication & login
AUTH_CLIENT_ID=

# ### OPTIONAL: Enable & configure email alerting
# OPTIONAL: Enable & configure email alerting
ALERT_SMTP_PASSWORD=
ALERT_SMTP_TO=
ALERT_SMTP_FROM=
Expand Down
35 changes: 25 additions & 10 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ permissions:
packages: write
checks: write

env:
IMAGE_REG: ghcr.io
IMAGE_NAME: bencuk/nanomon
IMAGE_TAG: dev
VERSION: dev

jobs:
lint-test:
name: Testing & Linting
Expand All @@ -31,11 +37,14 @@ jobs:
with:
go-version-file: go.mod

- name: Install just
uses: taiki-e/install-action@just

- name: Install tools
run: make install-tools
run: just install

- name: Linting & formatting
run: make lint
run: just lint

# Run tests and filter the output to JUnit format
- name: Run unit tests
Expand All @@ -53,10 +62,13 @@ jobs:

# Run API integration tests with output in JUnit format
- name: Run API integration tests
env:
PROMETHEUS_ENABLED: "1"
API_ENDPOINT: http://localhost:8000/api
run: |
make run-all PROMETHEUS_ENABLED=1 &
sleep 20
make test-api TEST_REPORT=1
just run-all &
sleep 25
just test-api true
- name: Test Report (Integration)
uses: phoenix-actions/test-reporting@v8
Expand All @@ -67,24 +79,27 @@ jobs:
reporter: java-junit

- name: Check the build
run: make build
env:
BUILD_INFO: "ignore me"
run: just build

image-build:
name: Build and push images
if: github.ref == 'refs/heads/main'
env:
IMAGE_TAG: dev
VERSION: dev
BUILD_INFO: "CI build, SHA:${{ github.sha }}"
runs-on: ubuntu-latest
needs: lint-test
steps:
- uses: actions/checkout@v4

- name: Install just
uses: taiki-e/install-action@just

- name: Build images
run: make images
run: just images

- name: Push images
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin
make push
just push
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ jobs:
echo IMAGE_TAG: $IMAGE_TAG
echo BUILD_INFO: $BUILD_INFO
- name: Install just
uses: taiki-e/install-action@just

- name: Build images
run: make images
run: just images

- name: Push images
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin
make push
just push
- name: Build & push latest
env:
IMAGE_TAG: latest
run: make images push
run: just images push
2 changes: 1 addition & 1 deletion api/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ The API specs for the Nanomon API resides here

The API is described using [TypeSpec](https://typespec.io/), see [typespec/main.tsp](typespec/main.tsp)

To build and generate the OpenAPI output run `make generate-specs`
To build and generate the OpenAPI output run `just generate-specs`
Loading

0 comments on commit c678711

Please sign in to comment.