Skip to content

debug ci

debug ci #1830

Workflow file for this run

# Build process
# Generate go and python artifacts using 3.9
# Test generated go artifacts using latest go
# Test generate python artifacts using 3.x
name: CICD
on:
- push
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.9]
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Generate only for 3.9
run: |
python do.py setup
python do.py init
python do.py dist
- name: Install package on clean env
run: |
rm -rf .env
python do.py setup
python do.py install
- name: Run python lint
run: |
python do.py lint true
- name: Archive generated artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: python_package
path: |
dist
pkg
dev_workflow_ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: actions/setup-go@v2
with:
go-version: "1.21"
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.3"
- name: Trigger dev workflow
run: |
python do.py build
# dev_workflow_macos:
# runs-on: macos-latest
# steps:
# - name: Checkout source
# uses: actions/checkout@v2
# with:
# ref: ${{ github.head_ref }}
# - name: Set up Python 3.10
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# - uses: actions/setup-go@v2
# with:
# go-version: "1.20"
# - name: Install Protoc
# uses: arduino/setup-protoc@v2
# with:
# version: "23.3"
# - name: Trigger dev workflow
# run: |
# python do.py build
# dev_workflow_windows:
# runs-on: windows-latest
# steps:
# - name: Checkout source
# uses: actions/checkout@v2
# with:
# ref: ${{ github.head_ref }}
# - name: Set up Python 3.10
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# - uses: actions/setup-go@v2
# with:
# go-version: "1.20"
# - name: Install Protoc
# uses: arduino/setup-protoc@v2
# with:
# version: "23.3"
# - name: Trigger dev workflow
# run: |
# python do.py build
dev_workflow_docker:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup docker
uses: docker/setup-buildx-action@v2
- name: Build image
run: |
docker build . -t openapiart:dev
- name: Start container
run: |
docker run -td openapiart:dev
- name: List containers
run: |
docker ps -a
python_tests:
needs: build
runs-on: ubuntu-20.04
strategy:
max-parallel: 6
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v2
id: download
with:
name: python_package
- name: Install dependencies
run: |
python do.py setup
python do.py install_package_only
- name: Run artifact generation
run: |
python do.py generate python True
- name: Archive generated artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: generated_py_package
path: |
art
- name: Display structure of downloaded files
run: ls -R
- name: Run python tests
run: |
python do.py install
sudo python do.py testpy
go_tests:
needs: build
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
go-version: ["1.21", "1.22", "1.23"]
fail-fast: false
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |
python do.py setup
python do.py init
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Setup Go and protoc
run: |
python do.py setup_ext ${{ matrix.go-version }}
- name: Run artifact generation
run: |
python do.py generate go
# - name: Run go lint
# run: |
# python do.py go_lint
- name: Archive generated artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: generated_go_package
path: |
pkg
art
- uses: actions/download-artifact@v2
with:
name: python_package
- name: Display structure of downloaded files
run: ls -R
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Run go tests
run: |
python do.py testgo
proto_yml_generation_test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/download-artifact@v2
id: download
with:
name: python_package
- name: Install dependencies
run: |
python do.py setup
python do.py install
- name: Run artifact generation
run: |
python do.py generate proto True
- name: Display structure of downloaded files
run: ls -R
- name: Check Genrated files
uses: andstor/file-existence-action@v2
with:
files: "art/openapi.json, art/openapi.yaml, art/sanity.proto"
fail: true
publish_python_package:
needs: [python_tests, go_tests, proto_yml_generation_test]
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/download-artifact@v2
with:
name: python_package
- name: Display structure of downloaded files
run: ls -R
- name: Get package version
id: get_version
run: |
echo "::set-output name=version::v$(python do.py version)"
- name: Check tag for current version
uses: mukunku/[email protected]
id: check_tag
with:
tag: ${{ steps.get_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package
if: steps.check_tag.outputs.exists == 'false'
run: |
PYPI_USERNAME=__token__ PYPI_PASSWORD=${{ secrets.PYPI_API_TOKEN }} python do.py release
- name: Create release and publish artifacts
if: steps.check_tag.outputs.exists == 'false'
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
tag: ${{ steps.get_version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}