Skip to content

Commit efd941f

Browse files
committed
chore: upgrade under nix
1 parent c6720e9 commit efd941f

File tree

9 files changed

+247
-77
lines changed

9 files changed

+247
-77
lines changed

.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: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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,12 +35,8 @@ jobs:
3535
with:
3636
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
3737
- run: >
38-
earthly
39-
--use-inline-cache --save-inline-cache --remote-cache=ghcr.io/formancehq/earthly --push
40-
--allow-privileged
41-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
42-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
43-
+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
4440
env:
4541
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
4642
- name: Get changed files
@@ -55,7 +51,7 @@ jobs:
5551
fi
5652
5753
Tests:
58-
runs-on: "ubuntu-latest"
54+
runs-on: "formance-runner"
5955
needs:
6056
- Dirty
6157
steps:
@@ -67,17 +63,13 @@ jobs:
6763
with:
6864
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
6965
- run: >
70-
earthly
71-
--no-output --use-inline-cache --save-inline-cache --remote-cache=ghcr.io/formancehq/earthly --push
72-
--allow-privileged
73-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
74-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
75-
+tests
66+
/nix/var/nix/profiles/default/bin/nix --extra-experimental-features "nix-command" --extra-experimental-features "flakes"
67+
develop --impure --command just tests
7668
env:
7769
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
7870
7971
GoReleaser:
80-
runs-on: "ubuntu-latest"
72+
runs-on: "formance-runner"
8173
if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' || github.event_name == 'merge_group'
8274
needs:
8375
- Dirty
@@ -94,15 +86,8 @@ jobs:
9486
with:
9587
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
9688
- run: >
97-
earthly
98-
--no-output --use-inline-cache --save-inline-cache --remote-cache=ghcr.io/formancehq/earthly --push
99-
--allow-privileged
100-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
101-
--secret GITHUB_TOKEN=$GITHUB_TOKEN
102-
--secret FURY_TOKEN=$FURY_TOKEN
103-
--secret GORELEASER_KEY=$GORELEASER_KEY
104-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
105-
+release --mode=ci
89+
/nix/var/nix/profiles/default/bin/nix --extra-experimental-features "nix-command" --extra-experimental-features "flakes"
90+
develop --impure --command just release-ci
10691
env:
10792
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
10893
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}

.github/workflows/releases.yml

Lines changed: 4 additions & 16 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:
@@ -18,22 +18,10 @@ jobs:
1818
with:
1919
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
2020
- run: >
21-
earthly
22-
--no-output --use-inline-cache --save-inline-cache --remote-cache=ghcr.io/formancehq/earthly --push
23-
--allow-privileged
24-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
25-
--secret GITHUB_TOKEN=$GITHUB_TOKEN
26-
--secret FURY_TOKEN=$FURY_TOKEN
27-
--secret GORELEASER_KEY=$GORELEASER_KEY
28-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
29-
+release --mode=release
21+
/nix/var/nix/profiles/default/bin/nix --extra-experimental-features "nix-command" --extra-experimental-features "flakes"
22+
develop release
3023
env:
3124
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
3225
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
3326
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
34-
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
35-
- name: Add the OpenAPI file to the release assets
36-
run: >
37-
gh release upload ${{github.ref_name}} ./openapi.yaml#openapi.yaml
38-
env:
39-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

.goreleaser.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ release:
3434
footer: |
3535
## What to do next?
3636
- Read the [documentation](https://docs.formance.com/)
37-
- Join our [Slack server](https://formance.com/slack)
37+
- Join our [Slack server](https://formance.com/slack)
38+
extra_files:
39+
- glob: ./openapi.yaml

Earthfile

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ build-image:
2929
ARG tag=latest
3030
DO core+SAVE_IMAGE --COMPONENT=webhooks --REPOSITORY=${REPOSITORY} --TAG=$tag
3131

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-
4032
deploy:
4133
COPY (+sources/*) /src
4234
LET tag=$(tar cf - /src | sha1sum | awk '{print $1}')
@@ -49,32 +41,6 @@ deploy:
4941
deploy-staging:
5042
BUILD --pass-args core+deploy-staging
5143

52-
lint:
53-
FROM core+builder-image
54-
COPY (+sources/*) /src
55-
COPY --pass-args +tidy/go.* .
56-
WORKDIR /src
57-
DO --pass-args core+GO_LINT
58-
SAVE ARTIFACT cmd AS LOCAL cmd
59-
SAVE ARTIFACT pkg AS LOCAL pkg
60-
SAVE ARTIFACT main.go AS LOCAL main.go
61-
62-
pre-commit:
63-
BUILD --pass-args +tidy
64-
BUILD --pass-args +lint
65-
6644
openapi:
6745
COPY ./openapi.yaml .
68-
SAVE ARTIFACT ./openapi.yaml
69-
70-
tidy:
71-
FROM core+builder-image
72-
COPY --pass-args (+sources/src) /src
73-
WORKDIR /src
74-
DO --pass-args core+GO_TIDY
75-
76-
release:
77-
FROM core+builder-image
78-
ARG mode=local
79-
COPY --dir . /src
80-
DO core+GORELEASER --mode=$mode
46+
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

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)