-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/cafeteria-tests
- Loading branch information
Showing
133 changed files
with
6,403 additions
and
8,385 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Trigger Client Update | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'server/api/tumdev/campus_backend.proto' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Fetch Changes | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Checkout everything to get access to the tags | ||
ref: main | ||
repository: TUM-Dev/Campus-Backend | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install Dart | ||
uses: dart-lang/setup-dart@v1 | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v3 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Needed Information | ||
run: | | ||
echo "LATEST_TAG=$(git describe --tags --always --abbrev=0)" >> $GITHUB_ENV | ||
echo "REPOSITORY=TUM-Dev/Campus-Flutter" >> $GITHUB_ENV | ||
echo "FOLDER=bin/\$REPOSITORY" >> $GITHUB_ENV | ||
echo "BRANCH_NAME=chore/update-protos-to-\$LATEST_TAG" >> $GITHUB_ENV | ||
- name: Clone Repository | ||
run: git clone --depth=1 --branch=main https://runner:${{ secrets.CAMPUS_FLUTTER_TOKEN }}@github.com/${{ env.REPOSITORY }} ${{ env.FOLDER }} | ||
|
||
- name: Update Proto Files | ||
run: | | ||
cd ${{ env.FOLDER }} | ||
git checkout -b ${{ env.BRANCH_NAME }} | ||
# Update the script files to the latest version. | ||
dart pub global activate protoc_plugin | ||
export PATH="$PATH:$HOME/.pub-cache/bin" | ||
curl -o protos/tumdev/campus_backend.proto https://raw.githubusercontent.com/TUM-Dev/Campus-Backend/main/server/api/tumdev/campus_backend.proto | ||
protoc --dart_out=grpc:lib/base/networking/apis -I./protos google/protobuf/timestamp.proto google/protobuf/empty.proto protos/tumdev/campus_backend.proto | ||
- name: Commit Changes | ||
id: commit | ||
run: | | ||
# Commit the changes and push the feature branch to origin | ||
cd ${{ env.FOLDER }} | ||
git add . | ||
git commit -m "chore: update scripts to ${{ env.LATEST_TAG }}" | ||
git push origin ${{ env.BRANCH_NAME }} | ||
continue-on-error: true | ||
|
||
- name: Create Pull Request | ||
if: steps.commit.outcome == 'success' | ||
run: | | ||
# Store the PAT in a file that can be accessed by the | ||
# GitHub CLI. | ||
cd ${{ env.FOLDER }} | ||
echo "${{ secrets.CAMPUS_FLUTTER_TOKEN }}" > token.txt | ||
# Authorize GitHub CLI for the current repository and | ||
# create a pull-requests containing the updates. | ||
gh auth login --with-token < token.txt | ||
gh pr create \ | ||
--body "" \ | ||
--title "Chore: Update Protos to ${{ env.LATEST_TAG }}" \ | ||
--head "${{ env.BRANCH_NAME }}" \ | ||
--base "main" | ||
- name: Error Message | ||
if: steps.commit.outcome != 'success' | ||
run: echo "No Changes made to Proto Files!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,26 +11,26 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
- name: golangci-lint-server | ||
uses: golangci/golangci-lint-action@v3 | ||
uses: golangci/golangci-lint-action@v4 | ||
with: | ||
version: v1.54 | ||
working-directory: server | ||
args: --timeout=30m | ||
- name: golangci-lint-client | ||
uses: golangci/golangci-lint-action@v3 | ||
uses: golangci/golangci-lint-action@v4 | ||
with: | ||
version: v1.54 | ||
working-directory: client | ||
args: --timeout=30m | ||
- run: go install golang.org/x/tools/cmd/goimports@latest | ||
- run: bash server/api/installBuf.bash | ||
- name: pre-commit | ||
uses: pre-commit/[email protected].0 | ||
- uses: ls-lint/action@v2.0.1 | ||
uses: pre-commit/[email protected].1 | ||
- uses: ls-lint/action@v2.2.2 | ||
with: | ||
config: .ls-lint.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Migration Test | ||
on: | ||
pull_request: | ||
branches: [ main ] | ||
concurrency: | ||
group: ${{ github.head_ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
test_migrations: | ||
runs-on: ubuntu-latest | ||
services: | ||
auto_mariadb: | ||
image: bitnami/mariadb:latest | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MARIADB_ROOT_PASSWORD: super_secret_passw0rd | ||
MARIADB_DATABASE: campus_db | ||
manual_mariadb: | ||
image: bitnami/mariadb:latest | ||
ports: | ||
- 3300:3306 | ||
env: | ||
MARIADB_ROOT_PASSWORD: super_secret_passw0rd | ||
MARIADB_DATABASE: campus_db | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache-dependency-path: | | ||
server/go.sum | ||
- name: run manual migrations | ||
run: go run main.go | ||
working-directory: ./server | ||
env: | ||
CI_EXIT_AFTER_MIGRATION: "true" | ||
CI_AUTO_MIGRATION: "false" | ||
DB_DSN: root:super_secret_passw0rd@tcp(localhost:3306)/campus_db?charset=utf8mb4&parseTime=True&loc=Local | ||
ENVIRONMENT: dev | ||
- name: run auto migrations | ||
run: go run main.go | ||
working-directory: ./server | ||
env: | ||
CI_EXIT_AFTER_MIGRATION: "true" | ||
CI_AUTO_MIGRATION: "true" | ||
DB_DSN: root:super_secret_passw0rd@tcp(localhost:3300)/campus_db?charset=utf8mb4&parseTime=True&loc=Local | ||
ENVIRONMENT: dev | ||
- uses: ariga/setup-atlas@master | ||
- name: export diff the migrations | ||
id: diff_migrations | ||
run: | | ||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) && | ||
echo "local_to_auto<<$EOF" >> $GITHUB_OUTPUT && | ||
atlas schema diff --from "maria://root:super_secret_passw0rd@localhost:3306/campus_db" --to "maria://root:super_secret_passw0rd@localhost:3300/campus_db" --format '{{ sql . " " }}' >> $GITHUB_OUTPUT && | ||
echo "$EOF" >> $GITHUB_OUTPUT | ||
echo "auto_to_local<<$EOF" >> $GITHUB_OUTPUT && | ||
atlas schema diff --from "maria://root:super_secret_passw0rd@localhost:3306/campus_db" --to "maria://root:super_secret_passw0rd@localhost:3300/campus_db" --format '{{ sql . " " }}' >> $GITHUB_OUTPUT && | ||
echo "$EOF" >> $GITHUB_OUTPUT | ||
- name: Find Comment | ||
uses: peter-evans/find-comment@v3 | ||
id: fc | ||
with: | ||
issue-number: "${{ github.event.number }}" | ||
body-includes: Found the following differences in the sql schema | ||
comment-author: github-actions[bot] | ||
- name: Create comment | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
issue-number: "${{ github.event.number }}" | ||
comment-id: "${{ steps.fc.outputs.comment-id }}" | ||
body: | | ||
:eyes: Found the following differences in the sql schema: | ||
<details> | ||
<summary>Needed get from <b>local</b> to <b>auto</b> migration state</summary> | ||
```sql | ||
${{ steps.diff_migrations.outputs.local_to_auto }} | ||
``` | ||
</details> | ||
<details> | ||
<summary>Needed from <b>auto</b> to <b>local</b> migration state</summary> | ||
```sql | ||
${{ steps.diff_migrations.outputs.auto_to_local }} | ||
``` | ||
</details> | ||
edit-mode: replace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.