From 1975c46b697607f5089db177a87a468e2f22dad1 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Mon, 22 Jan 2024 13:09:41 -0600 Subject: [PATCH] Add .gitea specific workflows. --- .gitea/workflows/on-pr.yaml | 78 +++++++++++++++++++++++++++++++++++ .gitea/workflows/publish.yaml | 26 ++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 .gitea/workflows/on-pr.yaml create mode 100644 .gitea/workflows/publish.yaml diff --git a/.gitea/workflows/on-pr.yaml b/.gitea/workflows/on-pr.yaml new file mode 100644 index 0000000..84ba726 --- /dev/null +++ b/.gitea/workflows/on-pr.yaml @@ -0,0 +1,78 @@ +name: Docker Build + +on: [pull_request] + +jobs: + build: + name: Run docker build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run docker build + run: docker compose build + test: + # Add a dummy job to avoid failing GitHub CI checks. + # Other checks to be added later. + name: Dummy job + runs-on: ubuntu-latest + steps: + - name: Run dummy job + run: echo "Empty dummy job" + # concise_migration_diff: + # name: Verify concise migration and generated schema + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Run docker concise migration build + # run: make docker-concise-migration-build + # - name: Run database + # run: docker-compose -f docker-compose.test.yml up -d test-db + # - name: Test concise migration + # run: | + # sleep 10 + # docker run --rm --network host -e DATABASE_USER=vdbm -e DATABASE_PASSWORD=password \ + # -e DATABASE_HOSTNAME=127.0.0.1 -e DATABASE_PORT=8066 -e DATABASE_NAME=vulcanize_testing \ + # vulcanize/concise-migration-build + # - name: Verify schema is latest + # run: | + # PGPASSWORD="password" pg_dump -h localhost -p 8066 -U vdbm vulcanize_testing --no-owner --schema-only > ./db/migration_schema.sql + # ./scripts/check_diff.sh ./db/migration_schema.sql db/schema.sql + + # incremental_migration_diff: + # name: Compare conscise migration schema with incremental migration. + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Run database + # run: docker-compose -f docker-compose.test.yml up -d test-db statediff-migrations + # - name: Test incremental migration + # run: | + # sleep 10 + # docker run --rm --network host -e DATABASE_USER=vdbm -e DATABASE_PASSWORD=password \ + # -e DATABASE_HOSTNAME=127.0.0.1 -e DATABASE_PORT=8066 -e DATABASE_NAME=vulcanize_testing \ + # vulcanize/statediff-migrations:v0.9.0 + # - name: Verify schema is latest + # run: | + # PGPASSWORD="password" pg_dump -h localhost -p 8066 -U vdbm vulcanize_testing --no-owner --schema-only > ./db/migration_schema.sql + # ./scripts/check_diff.sh db/schema.sql ./db/migration_schema.sql + + # migration: + # name: Compare up and down migration + # env: + # GOPATH: /tmp/go + # strategy: + # matrix: + # go-version: [ 1.16.x ] + # os: [ ubuntu-latest ] + # runs-on: ${{ matrix.os }} + # steps: + # - name: Create GOPATH + # run: mkdir -p /tmp/go + # - name: Install Go + # uses: actions/setup-go@v2 + # with: + # go-version: ${{ matrix.go-version }} + # - uses: actions/checkout@v2 + # - name: Test migration + # run: | + # timeout 5m make test-migrations diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml new file mode 100644 index 0000000..3b635e5 --- /dev/null +++ b/.gitea/workflows/publish.yaml @@ -0,0 +1,26 @@ +name: Publish Docker image +on: + release: + types: [published, edited] +jobs: + build: + name: Build and publish image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - id: vars + name: Output SHA and version tag + run: | + echo "sha=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT + echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: Build and tag image + run: | + docker build . \ + -t cerc-io/ipld-eth-db \ + -t git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}} \ + -t git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.tag}} + - name: Push image tags + run: | + echo ${{ secrets.CICD_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin + docker push git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}} + docker push git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.tag}} -- 2.45.2