From 543cd45d30f45f70fbcdf708d1827c4e98d09858 Mon Sep 17 00:00:00 2001 From: Rukmal Weerawarana Date: Wed, 28 Sep 2022 10:20:17 +0530 Subject: [PATCH] Fix workflow to update version numbers - Fix idempotence test workflow --- .github/workflows/push.yml | 28 +++++++++-------- .github/workflows/release.yml | 59 +++++++++++++++++++---------------- README.md | 2 +- 3 files changed, 48 insertions(+), 41 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 40bd7e5..17ee3d2 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -63,36 +63,38 @@ jobs: env: MYSQL_ROOT_PASSWORD: test ports: - - 4306:3306 + - 3306:3306 steps: - name: Checkout repository if: ${{ !env.act }} # Only run on GitHub Actions uses: actions/checkout@v3 + - name: Wait for database container to start + run: sleep 30s + shell: bash + - name: Get service container logs + run: docker logs -n 100 "${{ job.services.mysql.id }}" - name: Verify tables exist if: ${{ !env.ACT }} - run: echo "USE avinya_db; SHOW TABLES;" | mysql --host=$HOST --port=$PORT --user=$USER --password=$PASSWORD + run: echo "USE avinya_db; SHOW TABLES;" | mysql --host=$HOST --port=$PORT --user=$USER env: - HOST: "mysql" - PORT: 4306 + HOST: mysql + PORT: 3306 USER: root - PASSWORD: test - name: Run schema on database if: ${{ !env.act }} # Only run on GitHub Actions - run: cat ./schema/*.sql | mysql --host=$HOST --port=$PORT --user=$USER --password=$TEST + run: cat ./schema/*.sql | mysql --host=$HOST --port=$PORT --user=$USER env: - HOST: "mysql" - PORT: 4306 + HOST: mysql + PORT: 3306 USER: root - PASSWORD: test working-directory: db - name: Run schema on database again if: ${{ !env.act }} # Only run on GitHub Actions - run: cat ./schema/*.sql | mysql --host=$HOST --port=$PORT --user=$USER --password=$TEST + run: cat ./schema/*.sql | mysql --host=$HOST --port=$PORT --user=$USER env: - HOST: "mysql" - PORT: 4306 + HOST: mysql + PORT: 3306 USER: root - PASSWORD: test working-directory: db db-idempotence-local-test: name: (Local Only) Database Idempotence Test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 417e9d4..7f06141 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,33 +12,38 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Extract version number from tag - id: vars - # See: https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions - run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} - - name: Test output vars - env: - RELEASE_VERSION: ${{ steps.meta.vars.outputs.tag }} - run: echo $RELEASE_VERSION - # - name: Update API version in package files - # uses: ciiiii/toml-editor@1.0.0 - # with: - # file: api/Ballerina.toml - # key: "package.version" - # value: ${{ steps.vars.outputs.tag }} - # - name: Update client version in package files - # uses: ciiiii/toml-editor@1.0.0 - # with: - # file: client/Ballerina.toml - # key: "package.version" - # value: ${{ steps.vars.outputs.tag }} - # - name: Commit version changes to repository - # uses: EndBug/add-and-commit@v9 # See: https://github.com/marketplace/actions/add-commit - # with: - # add: "." - # push: origin main - # default_author: github_actions - # message: "[GitHub Actions] Commit version updates" + with: + ref: main + - name: Setup Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + # See: https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV + - name: Test + run: | + echo $RELEASE_VERSION + echo ${{ env.RELEASE_VERSION }} + - name: Install toml-cli to modify toml file + # See: https://pypi.org/project/toml-cli/ + run: | + python -m pip install toml-cli + - name: Update version in Ballerina.toml files + run: | + OLD_VERSION=$(toml get --toml-path api/Ballerina.toml package.version) + echo "Old package version: ${OLD_VERSION}" + echo "New package veresion: ${{ env.RELEASE_VERSION }}" + toml set --toml-path api/Ballerina.toml package.version ${{ env.RELEASE_VERSION }} + toml set --toml-path client/Ballerina.toml package.version ${{ env.RELEASE_VERSION }} + echo "Successfully updated package.version in api/Ballerina.toml and client/Ballerina.toml from ${OLD_VERSION} to version ${{ env.RELEASE_VERSION }}" + - name: Commit version changes to repository + uses: EndBug/add-and-commit@v9 # See: https://github.com/marketplace/actions/add-commit + with: + add: "." + push: origin main + default_author: github_actions + message: "[GitHub Actions] Commit version updates" update-staging-db: name: Update Azure staging database needs: update-version diff --git a/README.md b/README.md index 4c202a3..34b524e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Avinya Foundation Global Data Service -The Avinya Foundation's Global Data Service underlies the Avinya Foundation technology stack, and provides a universal interface to data across all applications in the organization. +The Avinya Foundation's Global Data Service underlies the Avinya Foundation technology stack, and provides a universal interface to foundation data to all applications in the organization. ## Component Documentation