diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml new file mode 100644 index 000000000..e54669d34 --- /dev/null +++ b/.github/workflows/build-package.yml @@ -0,0 +1,66 @@ +name: Build Package + +env: + MAIN_BRANCH: "all-pgautofailover-enterprise" + PACKAGE_CLOUD_REPO_NAME: "sample" + PACKAGE_ENCRYPTION_KEY: ${{ secrets.PACKAGE_ENCRYPTION_KEY }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + PACKAGE_CLOUD_API_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_TOKEN }} + PACKAGING_SECRET_KEY: ${{ secrets.PACKAGING_SECRET_KEY }} + PACKAGING_PASSPHRASE: ${{ secrets.PACKAGING_PASSPHRASE }} +on: + push: + branches: + - "**" + + workflow_dispatch: + +jobs: + build_package: + name: Build package + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: + - el/7 + - el/8 + - ol/7 + - debian/stretch + - debian/buster + - ubuntu/bionic + - ubuntu/focal + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Clone tools branch + run: git clone -b v0.8.1 --depth=1 https://github.com/citusdata/tools.git tools + + - name: Install package dependencies + run: sudo apt-get update && sudo apt install libcurl4-openssl-dev libssl-dev + + - name: Install python requirements + run: python -m pip install -r tools/packaging_automation/requirements.txt + + - name: Build packages + run: | + python -m tools.packaging_automation.citus_package \ + --gh_token "${GH_TOKEN}" \ + --platform "${{ matrix.platform }}" \ + --build_type "release" \ + --secret_key "${PACKAGING_SECRET_KEY}" \ + --passphrase "${PACKAGING_PASSPHRASE}" \ + --output_dir "$(pwd)/packages/" \ + --input_files_dir "$(pwd)" + + - name: Publish packages + run: | + python -m tools.packaging_automation.upload_to_package_cloud \ + --platform "${{ matrix.platform }}" \ + --package_cloud_api_token "${{ secrets.PACKAGE_CLOUD_API_TOKEN }}" \ + --repository_name "${PACKAGE_CLOUD_REPO_NAME}" \ + --output_file_path "$(pwd)/packages" \ + --current_branch "${GITHUB_REF##*/}" \ + --main_branch "${MAIN_BRANCH}" diff --git a/.github/workflows/update_package_properties.yml b/.github/workflows/update_package_properties.yml new file mode 100644 index 000000000..b4f14675a --- /dev/null +++ b/.github/workflows/update_package_properties.yml @@ -0,0 +1,52 @@ +name: Update Package Properties + +env: + PRJ_NAME: "pg_auto_failover_enterprise" + GH_TOKEN: ${{ secrets.GH_TOKEN }} +on: + workflow_dispatch: + inputs: + tag_name: + description: "The tag name on the project repo to be released" + fancy_version_no: + description: "If fancy versioning is needed, set value greater than 1 e.g 2" + default: "1" + microsoft_email: + description: "Email to be written on changelogs" + default: "gindibay@microsoft.com" + name: + description: "Name to be written on changelogs" + default: "Gurkan Indibay" +jobs: + update_package_properties: + name: Update package properties + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apt-get update && apt install libcurl4-openssl-dev libssl-dev + + - name: Clone tools branch + run: git clone -b v0.8.1 --depth=1 https://github.com/citusdata/tools.git tools + + - name: Set git name and email + run: | + git config --global user.email "${{ github.event.inputs.microsoft_email }}" && \ + git config --global user.name "${{ github.event.inputs.name }}" + + - name: Install python requirements + run: python -m pip install -r tools/packaging_automation/requirements.txt + + - name: Update package properties + run: | + python -m tools.packaging_automation.update_package_properties \ + --gh_token="${GH_TOKEN}" \ + --prj_name "${PRJ_NAME}" \ + --tag_name "${{ github.event.inputs.tag_name }}" \ + --email "${{ github.event.inputs.microsoft_email }}" \ + --name "${{ github.event.inputs.name }}" \ + --pipeline \ + --exec_path "$(pwd)" diff --git a/.travis.yml b/.travis.yml index f8e239ea3..011996ba9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ sudo: required -services: [ docker ] +services: [docker] language: perl perl: "5.18" env: @@ -27,7 +27,6 @@ env: # We do not have Ubuntu Focal repos yet on packages.microsoft.com - TARGET_PLATFORM=ubuntu/focal - TARGET_PLATFORM=ubuntu/bionic - - TARGET_PLATFORM=ubuntu/xenial # Packages on package cloud # Oracle Linux 6 is old and it doesn't work with static assert: # https://github.com/citusdata/pg_auto_failover/issues/200 @@ -53,19 +52,19 @@ before_install: fi install: true script: | - if [ ${TRAVIS_EVENT_TYPE} == 'push' ] || [ ${TRAVIS_EVENT_TYPE} == 'pull_request' ] || [ ${TRAVIS_EVENT_TYPE} == 'api' ] ; then - if [ -z "${UNENCRYPTED_PACKAGE:-}" ]; then - citus_package -p ${TARGET_PLATFORM} 'local' 'release' - else - build_new_release - fi - elif [ ${TRAVIS_EVENT_TYPE} == 'cron' ] ; then - if [ -z "${UNENCRYPTED_PACKAGE:-}" ]; then - citus_package -p ${TARGET_PLATFORM} 'local' 'nightly' - else - build_new_nightly - fi - fi + if [ ${TRAVIS_EVENT_TYPE} == 'push' ] || [ ${TRAVIS_EVENT_TYPE} == 'pull_request' ] || [ ${TRAVIS_EVENT_TYPE} == 'api' ] ; then + if [ -z "${UNENCRYPTED_PACKAGE:-}" ]; then + citus_package -p ${TARGET_PLATFORM} 'local' 'release' + else + build_new_release + fi + elif [ ${TRAVIS_EVENT_TYPE} == 'cron' ] ; then + if [ -z "${UNENCRYPTED_PACKAGE:-}" ]; then + citus_package -p ${TARGET_PLATFORM} 'local' 'nightly' + else + build_new_nightly + fi + fi deploy: - provider: packagecloud