update dependances and dev container #109
Workflow file for this run
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: unittest | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
pep8: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install poetry | |
poetry install --sync --with dev | |
- name: Lint with flake8 | |
run: | | |
poetry run flake8 . --count | |
test: | |
needs: pep8 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.12"] | |
gmssl-version: ["v3.1.1"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Download GmSSL | |
run: | | |
git clone -b '${{ matrix.gmssl-version }}' --depth 1 https://github.com/guanzhi/GmSSL.git | |
- name: Install GmSSL on ubuntu and macos | |
if: ${{ startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') }} | |
working-directory: ${{ github.workspace }}/GmSSL | |
run: | | |
mkdir build && cd build | |
cmake .. && make && make test && sudo make install | |
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | |
echo "Running ldconfig..." | |
sudo ldconfig | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
echo "Setting up DYLD_LIBRARY_PATH..." | |
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH | |
echo "Running gmssl version..." | |
gmssl version | |
fi | |
- name: Add nmake on windows | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Install GmSSL on windows | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
working-directory: ${{ github.workspace }}/GmSSL | |
run: | | |
"C:/Program Files/GmSSL/bin" | Out-File -FilePath $env:GITHUB_PATH -Append | |
mkdir build && cd build | |
cmake .. -G "NMake Makefiles" | |
nmake && nmake test && nmake install | |
- name: Set DYLD_LIBRARY_PATH on MacOS | |
if: startsWith(matrix.os, 'macos') | |
run: echo "DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV | |
- name: Check GmSSL version | |
run: gmssl version | |
- name: Install Python dependencies | |
run: | | |
python -m pip install poetry | |
poetry install --sync --without dev | |
- name: Test with pytest | |
run: | | |
poetry run pytest --cov=src --cov-report=xml:python${{ matrix.python-version }}-Gm${{ matrix.gmssl-version }}-${{ matrix.os }}-coverage.xml | |
- name: Upload coverage reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-file-python${{ matrix.python-version }}-Gm${{ matrix.gmssl-version }}-${{ matrix.os }} | |
path: python${{ matrix.python-version }}-Gm${{ matrix.gmssl-version }}-${{ matrix.os }}-coverage.xml | |
upload-coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download coverage reports | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: coverage-file-* | |
path: ./ | |
merge-multiple: true | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true # optional (default = false) | |
flags: unittests | |
name: codecov-umbrella | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true # optional (default = false) |