From 3a12d21949ee416fbf6c856aa32e07b9bf215ba1 Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Thu, 7 May 2020 18:03:01 +0200 Subject: [PATCH] Change github actions workflow strategy --- .github/workflows/deploy-cli.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 21 +++------------------ .github/workflows/test.yml | 16 ++++++---------- bin/deploy_cli | 27 --------------------------- cli/deploy | 25 +++++++++++++++++++++++++ cli/test | 11 +++++++++++ 6 files changed, 80 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/deploy-cli.yml delete mode 100755 bin/deploy_cli create mode 100755 cli/deploy create mode 100755 cli/test diff --git a/.github/workflows/deploy-cli.yml b/.github/workflows/deploy-cli.yml new file mode 100644 index 0000000..1fbee8b --- /dev/null +++ b/.github/workflows/deploy-cli.yml @@ -0,0 +1,35 @@ +name: deploy-cli + +on: + push: + paths: + - 'cli/lesspass/version.py' + +jobs: + test-cli: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v1 + with: + python-version: '3.6' + - name: test cli + run: | + cd cli + ./test + deploy-cli: + runs-on: ubuntu-latest + needs: test-cli + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v1 + with: + python-version: '3.6' + - name: deploy cli + run: | + cd cli + ./deploy + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fe651e4..067ad29 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,7 @@ jobs: deploy-containers: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: deploy containers run: | ./bin/deploy_containers @@ -20,32 +20,17 @@ jobs: deploy-node-modules: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: deploy node modules run: | ./bin/deploy_node_modules env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - deploy-cli: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: deploy cli - run: | - ./bin/deploy_cli - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - deploy-web-extensions: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: deploy web extensions run: | ./bin/deploy_web_extensions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bcf06d7..025fb86 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ jobs: test-packages: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: test packages run: | yarn install @@ -15,7 +15,7 @@ jobs: test-mobile: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: test mobile run: | cd mobile @@ -27,25 +27,21 @@ jobs: strategy: max-parallel: 3 matrix: - python-version: [3.5, 3.6, 3.7] + python-version: [3.6, 3.7, 3.8] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - name: test cli run: | cd cli - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install -r test-requirements.txt - export PYTHONPATH='.' - python -m unittest discover + ./test test-backend: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: python-version: "3.6" diff --git a/bin/deploy_cli b/bin/deploy_cli deleted file mode 100755 index 5acc892..0000000 --- a/bin/deploy_cli +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -function check_env_variables_are_setted { - if [ -z "${TWINE_USERNAME}" ] || [ -z "${TWINE_PASSWORD}" ]; then - echo "Need to set TWINE_USERNAME and TWINE_PASSWORD env variables to release cli" - exit 1 - fi -} - -set +o errexit - -check_env_variables_are_setted - -set -o errexit -set -o pipefail -set -o nounset - -function push_cli_on_pypi { - pushd cli - python -m pip install --upgrade pip - pip install setuptools wheel twine - python setup.py sdist bdist_wheel - twine upload dist/* - popd -} - -push_cli_on_pypi \ No newline at end of file diff --git a/cli/deploy b/cli/deploy new file mode 100755 index 0000000..11a430c --- /dev/null +++ b/cli/deploy @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +function check_env_variables_are_setted { + if [ -z "${TWINE_USERNAME}" ] || [ -z "${TWINE_PASSWORD}" ]; then + echo "Need to set TWINE_USERNAME and TWINE_PASSWORD env variables to release cli" + exit 1 + fi +} + +set +o errexit + +check_env_variables_are_setted + +set -o errexit +set -o pipefail +set -o nounset + +function push_cli_on_pypi { + python -m pip install --upgrade pip + pip install setuptools wheel twine + python setup.py sdist bdist_wheel + twine upload dist/* +} + +push_cli_on_pypi \ No newline at end of file diff --git a/cli/test b/cli/test new file mode 100755 index 0000000..e3f291d --- /dev/null +++ b/cli/test @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail +set -o nounset + +python -m pip install --upgrade pip +python -m pip install -r requirements.txt +python -m pip install -r test-requirements.txt +export PYTHONPATH='.' +python -m unittest discover \ No newline at end of file