Skip to content

Commit 6e84c85

Browse files
committed
chore: switch under nix/just
1 parent a35024a commit 6e84c85

9 files changed

Lines changed: 249 additions & 88 deletions

File tree

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
use flake --impure
2+
dotenv

.github/workflows/main.yml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
PR:
1717
if: github.event_name == 'pull_request'
1818
name: Check PR Title
19-
runs-on: ubuntu-latest
19+
runs-on: formance-runner
2020
permissions:
2121
statuses: write
2222
steps:
@@ -25,7 +25,7 @@ jobs:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626

2727
Dirty:
28-
runs-on: "ubuntu-latest"
28+
runs-on: "formance-runner"
2929
steps:
3030
- uses: 'actions/checkout@v4'
3131
with:
@@ -35,11 +35,8 @@ jobs:
3535
with:
3636
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
3737
- run: >
38-
earthly
39-
--allow-privileged
40-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
41-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
42-
+pre-commit
38+
/nix/var/nix/profiles/default/bin/nix --extra-experimental-features "nix-command" --extra-experimental-features "flakes"
39+
develop --impure --command just pre-commit
4340
env:
4441
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
4542
- name: Get changed files
@@ -54,7 +51,7 @@ jobs:
5451
fi
5552
5653
Tests:
57-
runs-on: "ubuntu-latest"
54+
runs-on: "formance-runner"
5855
needs:
5956
- Dirty
6057
steps:
@@ -66,17 +63,13 @@ jobs:
6663
with:
6764
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
6865
- run: >
69-
earthly
70-
--no-output
71-
--allow-privileged
72-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
73-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
74-
+tests
66+
/nix/var/nix/profiles/default/bin/nix --extra-experimental-features "nix-command" --extra-experimental-features "flakes"
67+
develop --impure --command just tests
7568
env:
7669
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
7770
7871
GoReleaser:
79-
runs-on: "ubuntu-latest"
72+
runs-on: "formance-runner"
8073
if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' || github.event_name == 'merge_group'
8174
needs:
8275
- Dirty
@@ -99,23 +92,16 @@ jobs:
9992
username: "NumaryBot"
10093
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
10194
- run: >
102-
earthly
103-
--no-output
104-
--allow-privileged
105-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
106-
--secret GITHUB_TOKEN=$GITHUB_TOKEN
107-
--secret FURY_TOKEN=$FURY_TOKEN
108-
--secret GORELEASER_KEY=$GORELEASER_KEY
109-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
110-
+release --mode=ci
95+
/nix/var/nix/profiles/default/bin/nix --extra-experimental-features "nix-command" --extra-experimental-features "flakes"
96+
develop --impure --command just release-ci
11197
env:
11298
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
11399
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
114100
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
115101
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
116102
117103
Deploy:
118-
runs-on: "ubuntu-latest"
104+
runs-on: "formance-runner"
119105
if: github.ref == 'refs/heads/main'
120106
environment: staging
121107
needs:

.github/workflows/releases.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88

99
jobs:
1010
GoReleaser:
11-
runs-on: "ubuntu-latest"
11+
runs-on: "formance-runner"
1212
steps:
1313
- uses: 'actions/checkout@v4'
1414
with:
@@ -24,15 +24,8 @@ jobs:
2424
username: "NumaryBot"
2525
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
2626
- run: >
27-
earthly
28-
--no-output
29-
--allow-privileged
30-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
31-
--secret GITHUB_TOKEN=$GITHUB_TOKEN
32-
--secret FURY_TOKEN=$FURY_TOKEN
33-
--secret GORELEASER_KEY=$GORELEASER_KEY
34-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
35-
+release --mode=release
27+
/nix/var/nix/profiles/default/bin/nix --extra-experimental-features "nix-command" --extra-experimental-features "flakes"
28+
develop --impure --command just +release --mode=release
3629
env:
3730
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
3831
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}

Earthfile

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ VERSION 0.8
22

33
IMPORT github.com/formancehq/earthly:tags/v0.16.2 AS core
44

5-
6-
75
FROM core+base-image
86

97
sources:
@@ -29,24 +27,6 @@ build-image:
2927
ARG tag=latest
3028
DO core+SAVE_IMAGE --COMPONENT=auth --REPOSITORY=${REPOSITORY} --TAG=$tag
3129

32-
tests:
33-
FROM core+builder-image
34-
COPY (+sources/*) /src
35-
WORKDIR /src
36-
WITH DOCKER --pull=postgres:15-alpine
37-
DO --pass-args core+GO_TESTS
38-
END
39-
40-
lint:
41-
FROM core+builder-image
42-
COPY (+sources/*) /src
43-
COPY --pass-args +tidy/go.* .
44-
WORKDIR /src
45-
DO --pass-args core+GO_LINT
46-
SAVE ARTIFACT cmd AS LOCAL cmd
47-
SAVE ARTIFACT pkg AS LOCAL pkg
48-
SAVE ARTIFACT main.go AS LOCAL main.go
49-
5030
deploy:
5131
COPY (+sources/*) /src
5232
LET tag=$(tar cf - /src | sha1sum | awk '{print $1}')
@@ -59,24 +39,6 @@ deploy:
5939
deploy-staging:
6040
BUILD --pass-args core+deploy-staging
6141

62-
pre-commit:
63-
WAIT
64-
BUILD --pass-args +tidy
65-
END
66-
BUILD --pass-args +lint
67-
6842
openapi:
6943
COPY ./openapi.yaml .
70-
SAVE ARTIFACT ./openapi.yaml
71-
72-
tidy:
73-
FROM core+builder-image
74-
COPY --pass-args (+sources/src) /src
75-
WORKDIR /src
76-
DO --pass-args core+GO_TIDY
77-
78-
release:
79-
FROM core+builder-image
80-
ARG mode=local
81-
COPY --dir . /src
82-
DO core+GORELEASER --mode=$mode
44+
SAVE ARTIFACT ./openapi.yaml

Justfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
set dotenv-load
2+
3+
default:
4+
@just --list
5+
6+
pre-commit: generate tidy lint
7+
pc: pre-commit
8+
9+
lint:
10+
@golangci-lint run --fix --build-tags it --timeout 5m
11+
12+
tidy:
13+
@go mod tidy
14+
15+
generate:
16+
@go generate ./...
17+
18+
tests:
19+
@go test -race -covermode=atomic \
20+
-coverprofile coverage.txt \
21+
-tags it \
22+
./...
23+
24+
generate-client:
25+
@speakeasy generate sdk -s openapi.yaml -o ./pkg/client -l go
26+
27+
release-local:
28+
@goreleaser release --nightly --skip=publish --clean
29+
30+
release-ci:
31+
@goreleaser release --nightly --clean
32+
33+
release:
34+
@goreleaser release --clean

README.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,17 @@
33
## Generate client code
44

55
```
6-
task generate-client
6+
just generate-client
77
```
88

99
## Tests
1010

1111
```
12-
task tests
12+
just tests
1313
```
1414

1515
## Lint
1616

1717
```
18-
task lint
19-
```
20-
21-
## Run the demo
22-
23-
Execute command :
24-
```bash
25-
docker compose up
26-
```
27-
will run all required components.
28-
29-
Now, you can open http://localhost:3000
18+
just lint
19+
```

flake.lock

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)