Skip to content

Commit

Permalink
build: Replace make with just
Browse files Browse the repository at this point in the history
* Adjust the '$ git describe --tag' invocation in the Justfile to work
  on a shallow clone of a repo. This error was always present when
  building via makefile, but execution was allowed to continue. When
  just is used, then the error is a show-stopper.
* Use shell interpreter in some Justfile recipes so that build
  environments can use the default shell, /bin/sh, rather than
  requiring them to install bash.
* Remove .dockerignore because we only need to pay attention to files
  under version control, and therefore could leverage the gitignore.
  Docker-related artifacts should be built from repo clones, which will
  only contain version-controlled files. Use of the ci.Justfile when
  building docker artifacts will make that happen.
  • Loading branch information
rafaelespinoza committed Jun 30, 2024
1 parent 96fd978 commit e730f4b
Show file tree
Hide file tree
Showing 23 changed files with 299 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .ci/cassandra/client.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM godfish_test/client_base:latest

WORKDIR /src
RUN make build-cassandra
RUN just build-cassandra

# Alpine linux doesn't have a cassandra client. Build a golang binary to check
# if server is ready and setup the test DB. Use it in the entrypoint.
Expand Down
6 changes: 3 additions & 3 deletions .ci/cassandra/client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -eu
dbhost="${1:?missing dbhost}"

echo "building binary"
make build-cassandra
just build-cassandra
echo "testing godfish"
make test ARGS='-v -count=1 -coverprofile=/tmp/cover.out'
just test '-v -count=1 -coverprofile=/tmp/cover.out'

# Wait for db server to be ready, with some limits.
num_attempts=0
Expand All @@ -25,4 +25,4 @@ done
>&2 echo "db is up"

echo "testing godfish against live db"
make test-cassandra ARGS='-v -count=1 -coverprofile=/tmp/cover_driver.out'
just test-cassandra '-v -count=1 -coverprofile=/tmp/cover_driver.out'
2 changes: 1 addition & 1 deletion .ci/client_base.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:alpine
WORKDIR /src
RUN apk update && apk --no-cache add gcc g++ git make
RUN apk update && apk --no-cache add gcc g++ git just
COPY go.mod /src
RUN go mod download && go mod verify
COPY . /src
2 changes: 1 addition & 1 deletion .ci/mysql/client.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM godfish_test/client_base:latest
WORKDIR /src
RUN apk update && \
apk --no-cache add mysql-client && \
make build-mysql
just build-mysql

COPY .ci/mysql/client.sh /
ENTRYPOINT /client.sh
6 changes: 3 additions & 3 deletions .ci/mysql/client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dbhost="${1:?missing dbhost}"
dbuser='godfish'

echo "building binary"
make build-mysql
just build-mysql
echo "testing godfish"
make test ARGS='-v -count=1 -coverprofile=/tmp/cover.out'
just test '-v -count=1 -coverprofile=/tmp/cover.out'

# Wait for db server to be ready, with some limits.

Expand All @@ -27,4 +27,4 @@ done
>&2 echo "db is up"

echo "testing godfish against live db"
make test-mysql ARGS='-v -count=1 -coverprofile=/tmp/cover_driver.out'
just test-mysql '-v -count=1 -coverprofile=/tmp/cover_driver.out'
2 changes: 1 addition & 1 deletion .ci/postgres/client.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM godfish_test/client_base:latest
WORKDIR /src
RUN apk update && \
apk --no-cache add postgresql-client && \
make build-postgres
just build-postgres

COPY .ci/postgres/client.sh /
ENTRYPOINT /client.sh
6 changes: 3 additions & 3 deletions .ci/postgres/client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ dbname='godfish_test'
dbuser='godfish'

echo "building binary"
make build-postgres
just build-postgres
echo "testing godfish"
make test ARGS='-v -count=1 -coverprofile=/tmp/cover.out'
just test '-v -count=1 -coverprofile=/tmp/cover.out'

# Wait for db server to be ready, with some limits.

Expand All @@ -27,4 +27,4 @@ done
>&2 echo "db is up"

echo "testing godfish against live db"
make test-postgres ARGS='-v -count=1 -coverprofile=/tmp/cover_driver.out'
just test-postgres '-v -count=1 -coverprofile=/tmp/cover_driver.out'
2 changes: 1 addition & 1 deletion .ci/sqlite3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV DB_DSN="file:/godfish_test.db"
WORKDIR /src
RUN apk update && \
apk --no-cache add musl-dev sqlite && \
make build-sqlite3
just build-sqlite3

COPY .ci/sqlite3/client.sh /
ENTRYPOINT /client.sh
6 changes: 3 additions & 3 deletions .ci/sqlite3/client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
set -eu

echo "building binary"
make build-sqlite3
just build-sqlite3

echo "testing godfish"
make test ARGS='-v -count=1 -coverprofile=/tmp/cover.out'
just test '-v -count=1 -coverprofile=/tmp/cover.out'

echo "testing godfish against live db"
make test-sqlite3 ARGS='-v -count=1 -coverprofile=/tmp/cover_driver.out'
just test-sqlite3 '-v -count=1 -coverprofile=/tmp/cover_driver.out'
2 changes: 1 addition & 1 deletion .ci/sqlserver/client.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM godfish_test/client_base:latest

WORKDIR /src
RUN make build-sqlserver
RUN just build-sqlserver

# Alpine linux doesn't have a SQL Server client. Build a golang binary to
# check if server is ready. Use it in the entrypoint.
Expand Down
6 changes: 3 additions & 3 deletions .ci/sqlserver/client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -eu

echo "building binary"
make build-sqlserver
just build-sqlserver
echo "testing godfish"
make test ARGS='-v -count=1 -coverprofile=/tmp/cover.out'
just test '-v -count=1 -coverprofile=/tmp/cover.out'

# Wait for db server to be ready, with some limits.

Expand All @@ -24,4 +24,4 @@ done
>&2 echo "db is up"

echo "testing godfish against live db"
make test-sqlserver ARGS='-v -count=1 -coverprofile=/tmp/cover_driver.out'
just test-sqlserver '-v -count=1 -coverprofile=/tmp/cover_driver.out'
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

12 changes: 8 additions & 4 deletions .github/workflows/build-cassandra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-cassandra3-up
run: just -f ci.Justfile ci-cassandra3-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -17,15 +19,17 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-cassandra3-down
run: just -f ci.Justfile ci-cassandra3-down
v4:
name: cassandra_v4
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-cassandra4-up
run: just -f ci.Justfile ci-cassandra4-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -34,4 +38,4 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-cassandra4-down
run: just -f ci.Justfile ci-cassandra4-down
18 changes: 12 additions & 6 deletions .github/workflows/build-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-mariadb-up
run: just -f ci.Justfile ci-mariadb-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -17,15 +19,17 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-mariadb-down
run: just -f ci.Justfile ci-mariadb-down
mysql_v57:
name: mysql v5.7
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-mysql57-up
run: just -f ci.Justfile ci-mysql57-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -34,15 +38,17 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-mysql57-down
run: just -f ci.Justfile ci-mysql57-down
mysql_v8:
name: mysql v8.0
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-mysql8-up
run: just -f ci.Justfile ci-mysql8-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -51,4 +57,4 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-mysql8-down
run: just -f ci.Justfile ci-mysql8-down
12 changes: 8 additions & 4 deletions .github/workflows/build-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-postgres14-up
run: just -f ci.Justfile ci-postgres14-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -17,15 +19,17 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-postgres14-down
run: just -f ci.Justfile ci-postgres14-down
v15:
name: postgres v15
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-postgres15-up
run: just -f ci.Justfile ci-postgres15-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -34,4 +38,4 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-postgres15-down
run: just -f ci.Justfile ci-postgres15-down
6 changes: 4 additions & 2 deletions .github/workflows/build-sqlite3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-sqlite3-up
run: just -f ci.Justfile ci-sqlite3-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -16,4 +18,4 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-sqlite3-down
run: just -f ci.Justfile ci-sqlite3-down
6 changes: 4 additions & 2 deletions .github/workflows/build-sqlserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Build environment and run tests
run: make -f ci.Makefile ci-sqlserver-up
run: just -f ci.Justfile ci-sqlserver-up
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -16,4 +18,4 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Teardown
run: make -f ci.Makefile ci-sqlserver-down
run: just -f ci.Justfile ci-sqlserver-down
4 changes: 3 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 1.18
- name: Install just
uses: extractions/setup-just@v2
- name: Vet source
run: make vet
run: just vet
Loading

0 comments on commit e730f4b

Please sign in to comment.