fix: change region ID #226
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: Test and build | |
"on": | |
push: | |
paths-ignore: | |
- ".github/**" | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install yamllint | |
run: sudo apt install yamllint | |
- name: Lint | |
run: yamllint . | |
quick_tests: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python_version: | |
- "3.11" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Sanity tests with dependencies | |
run: ansible-test sanity --requirements --python ${{ matrix.python_version }} | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Unit tests with dependencies | |
run: ansible-test units --requirements --python ${{ matrix.python_version }} | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Try-build by ansible-galaxy | |
run: ansible-galaxy collection build | |
working-directory: ansible_collections/serverscom/sc_api | |
integration_tests_cloud: | |
runs-on: ubuntu-20.04 | |
needs: quick_tests | |
concurrency: API | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Configure integration tests | |
run: | | |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml | |
env: | |
SC_TOKEN: "${{ secrets.SC_TOKEN }}" | |
- name: Integration tests | |
run: ansible-test integration --requirements --python 3.11 | |
sc_ssh_key | |
sc_cloud_computing_flavors_info | |
sc_cloud_computing_regions_info | |
sc_cloud_computing_images_info | |
sc_cloud_computing_openstack_credentials | |
sc_cloud_computing_instance | |
sc_cloud_computing_instance_info | |
sc_cloud_computing_instance_ptr | |
sc_cloud_computing_instances_info | |
sc_cloud_computing_instance_state | |
# sc_cloud_computing_instance_reinstall - broken and unfinished | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Cleanup secrets | |
if: always() | |
run: | | |
dd if=/dev/zero bs=4k count=4 of=ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml | |
sync | |
sync | |
integration_tests_bm: | |
runs-on: ubuntu-20.04 | |
needs: integration_tests_cloud | |
concurrency: API | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Configure integration tests | |
run: | | |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml | |
env: | |
SC_TOKEN: "${{ secrets.SC_TOKEN }}" | |
- name: Integration tests | |
run: ansible-test integration --requirements --python 3.11 | |
sc_ssh_key | |
sc_baremetal_locations_info | |
sc_baremetal_servers_info | |
sc_dedicated_server_info | |
sc_dedicated_server_reinstall_quick | |
sc_dedicated_server_reinstall_long | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Cleanup secrets | |
if: always() | |
run: | | |
dd if=/dev/zero bs=4k count=4 of=ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml | |
sync | |
sync | |
integration_tests_l2: | |
runs-on: ubuntu-20.04 | |
needs: integration_tests_bm | |
concurrency: API | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Configure integration tests | |
run: | | |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml | |
env: | |
SC_TOKEN: "${{ secrets.SC_TOKEN }}" | |
- name: Integration tests | |
run: ansible-test integration --requirements --python 3.11 | |
sc_l2_segment | |
sc_l2_segment_aliases | |
sc_l2_segments_info | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Cleanup secrets | |
if: always() | |
run: | | |
dd if=/dev/zero bs=4k count=4 of=ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml | |
sync | |
sync | |
build: | |
runs-on: ubuntu-20.04 | |
needs: integration_tests_l2 | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Remove tests from final distribution | |
run: rm -r tests/ | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Build collection | |
run: ansible-galaxy collection build | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Extract version | |
id: version | |
run: | | |
version=$(grep ^version galaxy.yml|awk '{print $2}') | |
echo "::set-output name=version::$version" | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Print artifact info | |
run: | | |
ls -la serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz | |
sha512sum serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz | |
tar tzf serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz | |
working-directory: ansible_collections/serverscom/sc_api | |
- name: Save artifact | |
if: ${{ endsWith(github.ref, steps.version.outputs.version) }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: sc_api | |
path: ansible_collections/serverscom/sc_api/serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz | |
publish: | |
runs-on: ubuntu-20.04 | |
needs: build | |
if: ${{ endsWith(github.ref, needs.build.outputs.version) }} | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: sc_api | |
- name: Debug output | |
run: ls -la serverscom-sc_api-${{needs.build.outputs.version }}.tar.gz | |
- name: Upload collection to galaxy | |
run: ansible-galaxy collection publish serverscom-sc_api-${{ needs.build.outputs.version }}.tar.gz --api-key="${{ secrets.GALAXY_API_TOKEN }}" |