-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gen: fixed generation of the workflow (#314)
Co-authored-by: dorav <[email protected]> Co-authored-by: Ariel Mashraki <[email protected]>
- Loading branch information
1 parent
41bc842
commit 7811e08
Showing
7 changed files
with
182 additions
and
73 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{{- define "services" }} | ||
{{- if eq .Driver "mysql" }} | ||
services: | ||
# Spin up a mysql:8 container to be used as the dev-database for analysis. | ||
mysql: | ||
image: mysql:8 | ||
env: | ||
MYSQL_DATABASE: dev | ||
MYSQL_ROOT_PASSWORD: pass | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd "mysqladmin ping -ppass" | ||
--health-interval 10s | ||
--health-start-period 10s | ||
--health-timeout 5s | ||
--health-retries 10 | ||
{{- else if eq .Driver "postgres" }} | ||
services: | ||
# Spin up a postgres:15 container to be used as the dev-database for analysis. | ||
postgres: | ||
image: postgres:15 | ||
env: | ||
POSTGRES_DB: dev | ||
POSTGRES_PASSWORD: pass | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-start-period 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
{{- else if eq .Driver "mariadb" }} | ||
services: | ||
# Spin up a mariadb:11 container to be used as the dev-database for analysis. | ||
mariadb: | ||
image: mariadb:11 | ||
env: | ||
MYSQL_DATABASE: dev | ||
MYSQL_ROOT_PASSWORD: pass | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd "healthcheck.sh --su-mysql --connect --innodb_initialized" | ||
--health-interval 10s | ||
--health-start-period 10s | ||
--health-timeout 5s | ||
--health-retries 10 | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "UseServices" }} | ||
{{- $Driver := index . 0 }} | ||
{{- $Host := index . 1 }} | ||
{{- if eq $Driver "mysql" -}} | ||
dev-url: 'mysql://root:pass@{{- $Host }}:3306/dev' | ||
{{- else if eq $Driver "postgres" -}} | ||
dev-url: 'postgres://postgres:pass@{{- $Host }}:5432/dev?search_path=public&sslmode=disable' | ||
{{- else if eq $Driver "mariadb" -}} | ||
dev-url: 'maria://root:pass@{{- $Host }}:3306/dev' | ||
{{- else if eq $Driver "sqlite" -}} | ||
dev-url: 'sqlite://dev?mode=memory' | ||
{{- end -}} | ||
{{- end -}} |
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,65 @@ | ||
name: Atlas | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
paths: | ||
- 'migrations/*' | ||
# Permissions to write comments on the pull request. | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
jobs: | ||
lint: | ||
services: | ||
# Spin up a mariadb:11 container to be used as the dev-database for analysis. | ||
mariadb: | ||
image: mariadb:11 | ||
env: | ||
MYSQL_DATABASE: dev | ||
MYSQL_ROOT_PASSWORD: pass | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd "healthcheck.sh --su-mysql --connect --innodb_initialized" | ||
--health-interval 10s | ||
--health-start-period 10s | ||
--health-timeout 5s | ||
--health-retries 10 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ariga/atlas-action@v0 | ||
with: | ||
dir: 'migrations' | ||
dev-url: 'maria://root:pass@localhost:3306/dev' | ||
cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
sync: | ||
needs: lint | ||
services: | ||
# Spin up a mariadb:11 container to be used as the dev-database for analysis. | ||
mariadb: | ||
image: mariadb:11 | ||
env: | ||
MYSQL_DATABASE: dev | ||
MYSQL_ROOT_PASSWORD: pass | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd "healthcheck.sh --su-mysql --connect --innodb_initialized" | ||
--health-interval 10s | ||
--health-start-period 10s | ||
--health-timeout 5s | ||
--health-retries 10 | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ariga/atlas-sync-action@v0 | ||
with: | ||
dir: 'migrations' | ||
dev-url: 'maria://root:pass@mariadb:3306/dev' | ||
cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} |
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