36
36
ts : ${{ steps.filter.outputs.ts }}
37
37
k8s : ${{ steps.filter.outputs.k8s }}
38
38
ci : ${{ steps.filter.outputs.ci }}
39
+ db : ${{ steps.filter.outputs.db }}
39
40
offlinedocs-only : ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }}
40
41
offlinedocs : ${{ steps.filter.outputs.offlinedocs }}
41
42
steps :
57
58
- "examples/web-server/**"
58
59
- "examples/monitoring/**"
59
60
- "examples/lima/**"
61
+ db:
62
+ - "**.sql"
63
+ - "coderd/database/queries/**"
64
+ - "coderd/database/migrations"
65
+ - "coderd/database/sqlc.yaml"
66
+ - "coderd/database/dump.sql"
60
67
go:
61
68
- "**.sql"
62
69
- "**.go"
@@ -137,7 +144,7 @@ jobs:
137
144
138
145
# Check for any typos
139
146
- name : Check for typos
140
- uses : crate-ci/typos@v1.16.23
147
+ uses : crate-ci/typos@v1.16.24
141
148
with :
142
149
config : .github/workflows/typos.toml
143
150
@@ -221,7 +228,7 @@ jobs:
221
228
with :
222
229
# This doesn't need caching. It's super fast anyways!
223
230
cache : false
224
- go-version : 1.20.11
231
+ go-version : 1.21.5
225
232
226
233
- name : Install shfmt
227
234
run : go install mvdan.cc/sh/v3/cmd/shfmt@v3.7.0
@@ -568,6 +575,16 @@ jobs:
568
575
with :
569
576
directory : offlinedocs
570
577
578
+ - name : Install Protoc
579
+ run : |
580
+ mkdir -p /tmp/proto
581
+ pushd /tmp/proto
582
+ curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
583
+ unzip protoc.zip
584
+ cp -r ./bin/* /usr/local/bin
585
+ cp -r ./include /usr/local/bin/include
586
+ popd
587
+
571
588
- name : Setup Go
572
589
uses : ./.github/actions/setup-go
573
590
@@ -608,6 +625,7 @@ jobs:
608
625
- test-js
609
626
- test-e2e
610
627
- offlinedocs
628
+ - sqlc-vet
611
629
# Allow this job to run even if the needed jobs fail, are skipped or
612
630
# cancelled.
613
631
if : always()
@@ -751,13 +769,16 @@ jobs:
751
769
service_account : coder-ci@coder-dogfood.iam.gserviceaccount.com
752
770
753
771
- name : Set up Google Cloud SDK
754
- uses : google-github-actions/setup-gcloud@v1
772
+ uses : google-github-actions/setup-gcloud@v2
755
773
756
774
- name : Set up Flux CLI
757
775
uses : fluxcd/flux2/action@main
776
+ with :
777
+ # Keep this up to date with the version of flux installed in dogfood cluster
778
+ version : " 2.2.0"
758
779
759
780
- name : Get Cluster Credentials
760
- uses : " google-github-actions/get-gke-credentials@v1 "
781
+ uses : " google-github-actions/get-gke-credentials@v2 "
761
782
with :
762
783
cluster_name : dogfood-v2
763
784
location : us-central1-a
@@ -771,7 +792,9 @@ jobs:
771
792
flux --namespace flux-system reconcile kustomization flux-system
772
793
flux --namespace flux-system reconcile kustomization coder
773
794
flux --namespace flux-system reconcile source chart coder-coder
795
+ flux --namespace flux-system reconcile source chart coder-coder-provisioner
774
796
flux --namespace coder reconcile helmrelease coder
797
+ flux --namespace coder reconcile helmrelease coder-provisioner
775
798
776
799
# Just updating Flux is usually not enough. The Helm release may get
777
800
# redeployed, but unless something causes the Deployment to update the
@@ -783,6 +806,8 @@ jobs:
783
806
set -euxo pipefail
784
807
kubectl --namespace coder rollout restart deployment/coder
785
808
kubectl --namespace coder rollout status deployment/coder
809
+ kubectl --namespace coder rollout restart deployment/coder-provisioner
810
+ kubectl --namespace coder rollout status deployment/coder-provisioner
786
811
787
812
deploy-wsproxies :
788
813
runs-on : ubuntu-latest
@@ -810,55 +835,28 @@ jobs:
810
835
TOKEN_SAO_PAULO : ${{ secrets.FLY_SAO_PAULO_CODER_PROXY_SESSION_TOKEN }}
811
836
812
837
deploy-legacy-proxies :
813
- name : " deploy-legacy-proxies"
814
- runs-on : ${{ github.repository_owner == 'coder' && 'buildjet-16vcpu-ubuntu-2204' || 'ubuntu-latest' }}
838
+ runs-on : ubuntu-latest
815
839
timeout-minutes : 30
816
- needs : changes
817
- if : |
818
- github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
819
- && needs.changes.outputs.docs-only == 'false'
840
+ needs : build
841
+ if : github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
820
842
permissions :
821
843
contents : read
822
844
id-token : write
823
845
steps :
824
- - name : Checkout
825
- uses : actions/checkout@v4
826
- with :
827
- fetch-depth : 0
828
-
829
846
- name : Authenticate to Google Cloud
830
847
uses : google-github-actions/auth@v2
831
848
with :
832
849
workload_identity_provider : projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
833
850
service_account : coder-ci@coder-dogfood.iam.gserviceaccount.com
834
851
835
852
- name : Set up Google Cloud SDK
836
- uses : google-github-actions/setup-gcloud@v1
837
-
838
- - name : Setup Node
839
- uses : ./.github/actions/setup-node
840
-
841
- - name : Setup Go
842
- uses : ./.github/actions/setup-go
843
-
844
- - name : Install goimports
845
- run : go install golang.org/x/tools/cmd/goimports@latest
846
- - name : Install nfpm
847
- run : go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.16.0
848
-
849
- - name : Install zstd
850
- run : sudo apt-get install -y zstd
851
-
852
- - name : Build Release
853
- run : |
854
- set -euo pipefail
855
- go mod download
853
+ uses : google-github-actions/setup-gcloud@v2
856
854
857
- version="$(./scripts/version.sh)"
858
- make gen/mark-fresh
859
- make -j \
860
- build/coder_"$version"_windows_amd64.zip \
861
- build/coder_"$version"_linux_amd64.{tar.gz,deb}
855
+ - name : Download build artifacts
856
+ uses : actions/download-artifact@v3
857
+ with :
858
+ name : coder
859
+ path : ./build
862
860
863
861
- name : Install Release
864
862
run : |
@@ -871,11 +869,11 @@ jobs:
871
869
"southamerica-east1-b coder-brazil coder-workspace-proxy"
872
870
)
873
871
874
- deb_pkg="./build/coder_$(./scripts/version.sh) _linux_amd64.deb"
875
- if [ ! -f "$deb_pkg" ]; then
876
- echo "deb package not found: $deb_pkg "
877
- ls -l ./build
878
- exit 1
872
+ deb_pkg=$(find ./build -name "coder_* _linux_amd64.deb" -print -quit)
873
+ if [ -z "$deb_pkg" ]; then
874
+ echo "deb package $deb_pkg not found"
875
+ ls -l ./build
876
+ exit 1
879
877
fi
880
878
881
879
gcloud config set project coder-dogfood
@@ -891,3 +889,26 @@ jobs:
891
889
892
890
echo "::endgroup::"
893
891
done
892
+
893
+ # sqlc-vet runs a postgres docker container, runs Coder migrations, and then
894
+ # runs sqlc-vet to ensure all queries are valid. This catches any mistakes
895
+ # in migrations or sqlc queries that makes a query unable to be prepared.
896
+ sqlc-vet :
897
+ runs-on : ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
898
+ needs : changes
899
+ if : needs.changes.outputs.db == 'true' || github.ref == 'refs/heads/main'
900
+ steps :
901
+ - name : Checkout
902
+ uses : actions/checkout@v4
903
+ with :
904
+ fetch-depth : 1
905
+ # We need golang to run the migration main.go
906
+ - name : Setup Go
907
+ uses : ./.github/actions/setup-go
908
+
909
+ - name : Setup sqlc
910
+ uses : ./.github/actions/setup-sqlc
911
+
912
+ - name : Setup and run sqlc vet
913
+ run : |
914
+ make sqlc-vet
0 commit comments