From 7eafeeff1b97d2d7832922da2a6797aa618ab84f Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Tue, 18 Jul 2023 13:43:13 -0700 Subject: [PATCH] Generate dotnet project package. --- .github/actions/build-package/action.yml | 46 ---------- .github/actions/lint/action.yml | 54 ------------ .github/workflows/pr-check.yml | 103 ++++++++++++++++++++-- .github/workflows/push-check.yml | 105 +++++++++++++++++++++-- 4 files changed, 197 insertions(+), 111 deletions(-) delete mode 100644 .github/actions/build-package/action.yml delete mode 100644 .github/actions/lint/action.yml diff --git a/.github/actions/build-package/action.yml b/.github/actions/build-package/action.yml deleted file mode 100644 index 1a909ec..0000000 --- a/.github/actions/build-package/action.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: "Build Python Package" -description: "Build the package to upload to pypi." - -runs: - using: "composite" - steps: - # Minimum supported version is Python 3.7 - - name: Use Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Pip cache - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-build-vsix-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip-build-vsix- - - - name: Upgrade Pip - run: python -m pip install -U pip - shell: bash - - # For faster/better builds of sdists. - - name: Install build pre-requisite - run: python -m pip install wheel - shell: bash - - - name: Install nox - run: python -m pip install nox - shell: bash - - - name: Build sdist and wheels - run: python -m nox --session build - shell: bash - - - name: Upload Packages to Artifacts - uses: actions/upload-artifact@v3 - with: - name: pypi-packages - path: | - packages/python/dist/*.gz - packages/python/dist/*.whl - if-no-files-found: error - retention-days: 7 diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml deleted file mode 100644 index 2e8e411..0000000 --- a/.github/actions/lint/action.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: 'Lint' -description: 'Lint Python code' - -runs: - using: 'composite' - steps: - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Pip cache - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip-lint- - - - name: Upgrade Pip - run: python -m pip install -U pip - shell: bash - - # For faster/better builds of sdists. - - name: Install build pre-requisite - run: python -m pip install wheel - shell: bash - - - name: Install nox - run: python -m pip install nox - shell: bash - - - name: Check linting and formatting - run: python -m nox --session lint - shell: bash - - - name: Rust Tool Chain setup - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: rustfmt - - - name: Rustfmt Check - uses: actions-rust-lang/rustfmt@v1 - with: - manifest-path: packages/rust/lsprotocol/Cargo.toml - - - name: Dotnet Tool Chain setup - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' - - - name: Dotnet Format Check - run: dotnet format packages/dotnet/lsprotocol/lsprotocol.csproj --verify-no-changes - shell: bash diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 2bfd39d..09898a5 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -5,14 +5,42 @@ on: jobs: build-package: - name: Create Packages + name: Create PyPI Packages runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: Build Packages - uses: ./.github/actions/build-package + - name: Use Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-build-vsix-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-build-vsix- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Build sdist and wheels + run: python -m nox --session build + shell: bash + + - name: Upload Python Packages to Artifacts + uses: actions/upload-artifact@v3 + with: + name: pypi-packages + path: | + packages/python/dist/*.gz + packages/python/dist/*.whl + if-no-files-found: error + retention-days: 7 lint: name: Lint @@ -21,8 +49,45 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Lint - uses: ./.github/actions/lint + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-lint- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Check linting and formatting + run: python -m nox --session lint + shell: bash + + - name: Rust Tool Chain setup + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 + with: + manifest-path: packages/rust/lsprotocol/Cargo.toml + + - name: Dotnet Tool Chain setup + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Dotnet Format Check + run: dotnet format packages/dotnet/lsprotocol/lsprotocol.csproj --verify-no-changes + shell: bash python-tests: name: Python Tests @@ -90,6 +155,34 @@ jobs: env: LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata + dotnet-project: + name: Dotnet Project + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install Generator + run: python -m pip install -r ./requirements.txt + + - name: Generate C# Code + run: python -m generator --plugin dotnet + + - name: Upload Dotnet Project to Artifacts + uses: actions/upload-artifact@v3 + with: + name: dotnet-project + path: | + packages/dotnet/lsprotocol/*.csproj + packages/dotnet/lsprotocol/*.cs + if-no-files-found: error + retention-days: 7 + smoke-tests: name: Smoke Tests (pygls) runs-on: ${{ matrix.os }} diff --git a/.github/workflows/push-check.yml b/.github/workflows/push-check.yml index c126f72..d5f179a 100644 --- a/.github/workflows/push-check.yml +++ b/.github/workflows/push-check.yml @@ -9,15 +9,43 @@ on: - 'release-*' jobs: - build-vsix: - name: Create Packages + build-package: + name: Create PyPI Packages runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: Build Packages - uses: ./.github/actions/build-package + - name: Use Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-build-vsix-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-build-vsix- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Build sdist and wheels + run: python -m nox --session build + shell: bash + + - name: Upload Python Packages to Artifacts + uses: actions/upload-artifact@v3 + with: + name: pypi-packages + path: | + packages/python/dist/*.gz + packages/python/dist/*.whl + if-no-files-found: error + retention-days: 7 lint: name: Lint @@ -26,8 +54,45 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Lint - uses: ./.github/actions/lint + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-lint- + + - name: Install nox + run: python -m pip install nox + shell: bash + + - name: Check linting and formatting + run: python -m nox --session lint + shell: bash + + - name: Rust Tool Chain setup + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 + with: + manifest-path: packages/rust/lsprotocol/Cargo.toml + + - name: Dotnet Tool Chain setup + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Dotnet Format Check + run: dotnet format packages/dotnet/lsprotocol/lsprotocol.csproj --verify-no-changes + shell: bash python-tests: name: Python Tests @@ -90,3 +155,31 @@ jobs: shell: bash env: LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata + + dotnet-project: + name: Dotnet Project + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install Generator + run: python -m pip install -r ./requirements.txt + + - name: Generate C# Code + run: python -m generator --plugin dotnet + + - name: Upload Dotnet Project to Artifacts + uses: actions/upload-artifact@v3 + with: + name: dotnet-project + path: | + packages/dotnet/lsprotocol/*.csproj + packages/dotnet/lsprotocol/*.cs + if-no-files-found: error + retention-days: 7