From 7e6378f565f57f3e8719c98c68431a723a77631a Mon Sep 17 00:00:00 2001 From: Jien Huang <huangjien@gmail.com> Date: Tue, 2 Nov 2021 10:59:48 +0000 Subject: [PATCH] Develop (#30) * Create main.yml * runs on ubuntu * set secret * set secret * format * format * lint * job level * matrix * quote * add scenarios * add collection * use a way * fix lint issue * fix lint issue * add another branch for test * add ohs * typo * add sanity check * fix branches * not working * python_ver * add release.yml * add release.yml * yamllint issue * remove dotnet * remove some tools * wrong file * more space * more space * more space * more space * more space * more space * more space * more space * more space * more space * more space * update version * description * Enable GH Actions (#28) * Test Actions matrix Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Configure cache Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Rename workflow Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Disable fail-fast for matrix Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Checkout into custom directory Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Change working directory for run commands Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Setup separate workflow for sanity checks Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Prepare environment for sanity tests Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Only run within upstream org Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Add release workflow Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Add guard around molecule test execution Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Update workflow descriptions Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Add token variables for Galaxy Signed-off-by: Andrey Zhereshchin <a.zhereshchin@gmail.com> * Synchronise logic with upstream main branch * merge testaction Co-authored-by: root <root@jien0001-devenv.fyre.ibm.com> Co-authored-by: Andrey Zhereshchin <2170339+andreyzher@users.noreply.github.com> --- .editorconfig | 8 +++ .github/workflows/main.yml | 107 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 71 ++++++++++++++++++++++ galaxy.yml | 2 +- 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/release.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..f0f98481 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..365c12a9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,107 @@ +--- +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events + # but only for the main branch + push: + branches: [main] + pull_request: + branches: ['*'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs +# that can run sequentially or in parallel +jobs: + ci: + env: + ARTIFACTORY_TOKEN: "${{ secrets.ARTIFACTORY_TOKEN }}" + ARTIFACTORY_REPO: "${{ secrets.ARTIFACTORY_REPO }}" + ARTIFACTORY_URL: "${{ secrets.ARTIFACTORY_URL }}" + collection_namespace: ibm + collection_name: spm_middleware + python_ver: 3.8 + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + scenario: + - websphere-v90-centos-8 + - websphere-v85-centos-7 + - db2111 + - db2115 + - oracle12cR1-centos-7 + - oracle12cR2-centos-7 + - oracle19c-centos-8 + - iim-191-centos-8 + - ihs-v90-centos-8 + - ihs-v80-centos-7 + - ohs-v12.2.1-centos-7 + - ohs-v12.2.1-centos-8 + - ohs-v12.1.3-centos-7 + - liberty-centos-7 + - liberty-centos-8 + - weblogic-centos-7 + - weblogic-centos-8 + defaults: + run: + working-directory: ansible_collections/${{ env.collection_namespace }}/${{ env.collection_name }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: ansible_collections/${{ env.collection_namespace }}/${{ env.collection_name }} + - name: Setup Python v${{ env.python_ver }} + uses: actions/setup-python@v2 + with: + python-version: ${{ env.python_ver }} + # remove android and dotnet to gain more spaces for oracle installation + - name: Maximize build space + run: | + df -h + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + df -h + - name: Setup Python Cache + uses: actions/cache@v2 + with: + key: pip-${{ matrix.scenario }}-${{ hashFiles('ci-requirements.txt') }} + path: | + ~/.cache/pip + !~/.cache/pip/log/debug.log + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -r ci-requirements.txt + - name: Prepare environment + run: | + mkdir -pv ~/.ansible/collections/${{ env.collection_namespace }} + ln -s ansible_collections/${{ env.collection_namespace }}/${{ env.collection_name }} ~/.ansible/collections/${{ env.collection_namespace }}/${{ env.collection_name }} + chmod -v +x ./scripts/* + - name: Sanity checks + run: | + ansible-test sanity --docker -v --color --python ${{ env.python_ver }} + - name: Molecule + run: | + molecule test -s ${{ matrix.scenario }} + # - name: Publish to Galaxy + # env: + # ANSIBLE_GALAXY_SERVER_LIST: release + # ANSIBLE_GALAXY_SERVER_RELEASE_URL: https://galaxy.ansible.com/ + # ANSIBLE_GALAXY_SERVER_RELEASE_TOKEN: "${{ secrets.GALAXY_TOKEN }}" + # run: | + # ansible-galaxy collection build + # ls -l *.tar.gz + # ansible-galaxy collection publish -c -vvv "./${{ env.collection_namespace }}-${{ env.collection_name }}-*.tar.gz" + # - name: Create GitHub Release + # uses: marvinpinto/action-automatic-releases@latest + # with: + # repo_token: "${{ secrets.GITHUB_TOKEN }}" + # prerelease: false + # files: | + # ${{ env.collection_namespace }}-${{ env.collection_name }}-*.tar.gz diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..eba6226d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,71 @@ +--- +# This is a basic workflow to help you get started with Actions +name: release + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events + # but only for the main branch + push: + branches: [main] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs +# that can run sequentially or in parallel +jobs: + release: + env: + collection_namespace: ibm + collection_name: spm_middleware + python_ver: 3.8 + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/${{ env.collection_namespace }}/${{ env.collection_name }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: ansible_collections/${{ env.collection_namespace }}/${{ env.collection_name }} + - name: Setup Python v${{ env.python_ver }} + uses: actions/setup-python@v2 + with: + python-version: ${{ env.python_ver }} + + - name: Setup Python Cache + uses: actions/cache@v2 + with: + key: pip-${{ matrix.scenario }}-${{ hashFiles('ci-requirements.txt') }} + path: | + ~/.cache/pip + !~/.cache/pip/log/debug.log + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -r ci-requirements.txt + - name: Prepare environment + run: | + mkdir -pv ~/.ansible/collections/${{ env.collection_namespace }} + ln -s ansible_collections/${{ env.collection_namespace }}/${{ env.collection_name }} ~/.ansible/collections/${{ env.collection_namespace }}/${{ env.collection_name }} + chmod -v +x ./scripts/* + - name: Not fully ready yet + run: | + echo "Need more test before push to https://galaxy.ansible.com/" + # - name: Publish to Galaxy + # env: + # ANSIBLE_GALAXY_SERVER_LIST: release + # ANSIBLE_GALAXY_SERVER_RELEASE_URL: https://galaxy.ansible.com/ + # ANSIBLE_GALAXY_SERVER_RELEASE_TOKEN: "${{ secrets.GALAXY_TOKEN }}" + # run: | + # ansible-galaxy collection build + # ls -l *.tar.gz + # ansible-galaxy collection publish -c -vvv "./${{ env.collection_namespace }}-${{ env.collection_name }}-*.tar.gz" + # - name: Create GitHub Release + # uses: marvinpinto/action-automatic-releases@latest + # with: + # repo_token: "${{ secrets.GITHUB_TOKEN }}" + # prerelease: false + # files: | + # ${{ env.collection_namespace }}-${{ env.collection_name }}-*.tar.gz diff --git a/galaxy.yml b/galaxy.yml index 964d69c1..45c4d2c4 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: ibm name: spm_middleware # The version of the collection. Must be compatible with semantic versioning -version: 1.1.2 +version: 1.1.3 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md