Passage en monorepo #20
Workflow file for this run
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
name: Publish Docker image | |
on: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
# release: | |
# types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
#test-unit: | |
build-tools: | |
environment: dev | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- name: Login into registry | |
run: earthly +docker-dev-login --GH_USER=${{ secrets.GH_USER }} --GH_TOKEN=${{ secrets.GH_TOKEN }} | |
- name: Build and push Sqitch | |
run: earthly --use-inline-cache --save-inline-cache --push +sqitch-build | |
- name: Build and push pg_tap | |
run: earthly --use-inline-cache --save-inline-cache --push +pg-tap-build | |
build-business-dev: | |
# todo: needs: unit-test | |
environment: dev | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- name: Login into registry | |
run: earthly +docker-dev-login --GH_USER=${{ secrets.GH_USER }} --GH_TOKEN=${{ secrets.GH_TOKEN }} | |
- name: Build and push business deps image | |
run: earthly --use-inline-cache --save-inline-cache --push +business-build | |
build-app-dev: | |
# todo: needs: unit-test | |
environment: dev | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- name: Login into registry | |
run: earthly +docker-dev-login --GH_USER=${{ secrets.GH_USER }} --GH_TOKEN=${{ secrets.GH_TOKEN }} | |
- name: Build and push front deps image | |
run: earthly --use-inline-cache --save-inline-cache --push +front-deps | |
- name: Build and push app image | |
run: earthly --use-inline-cache --save-inline-cache --push +app-build --ANON_KEY=${{ secrets.ANON_KEY }} --API_URL=${{ secrets.API_URL }} | |
test-api: | |
needs: | |
- build-app-dev | |
- build-business-dev | |
- build-tools | |
environment: dev | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: 1.52.3 | |
- name: Start services | |
run: > | |
earthly +dev | |
--stop=no --datalayer=yes --business=yes --app=no --eco=yes --fast=no --version=HEAD | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
- name: Reset de postgrest | |
run: docker restart supabase_rest_tet | |
- name: Test curl | |
run: > | |
earthly +curl-test | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
- name: Test API | |
run: > | |
earthly +api-test --tests 'base droit historique plan_action labellisation indicateurs utilisateur' | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
test-business: | |
needs: | |
- build-business-dev | |
- build-tools | |
environment: dev | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: 1.52.3 | |
- name: Start services | |
run: > | |
earthly +dev | |
--stop=no --datalayer=yes --business=no --app=no --eco=yes --fast=no --version=HEAD | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
- name: Reset de postgrest | |
run: docker restart supabase_rest_tet | |
- name: Test curl | |
run: > | |
earthly +curl-test | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
- name: Test Business | |
run: > | |
earthly +business-test | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
test-deploy: | |
needs: | |
- build-business-dev | |
- build-tools | |
environment: dev | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: 1.52.3 | |
- name: Start services | |
run: > | |
earthly +dev | |
--stop=no --datalayer=yes --business=no --app=no --eco=yes --fast=no --version=HEAD | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
- name: Test curl | |
run: > | |
earthly +curl-test | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
- name: Test Deploy | |
run: > | |
earthly +deploy-test | |
--DB_URL=${{ secrets.DB_URL }} | |
test-db: | |
needs: | |
- build-business-dev | |
- build-tools | |
environment: dev | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: 1.52.3 | |
- name: Start services | |
run: > | |
earthly +dev | |
--stop=no --datalayer=yes --business=no --app=no --eco=no --fast=no --version=HEAD | |
--DB_URL=${{ secrets.DB_URL }} | |
--SERVICE_ROLE_KEY=${{ secrets.SERVICE_ROLE_KEY }} | |
--API_URL=${{ secrets.API_URL }} | |
- name: Test Deploy | |
run: > | |
earthly +db-test | |
--DB_URL=${{ secrets.DB_URL }} | |
deploy: | |
environment: preprod | |
# todo: if: ${{ github.ref == 'refs/heads/main' }} | |
needs: [test-api] | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.20 | |
- name: Deploy site on koyeb | |
run: earthly +site-deploy --KOYEB_API_KEY=${{ secrets.KOYEB_API_KEY }} |