Merge pull request #168 from SamR1/move-ci-to-github-actions

Move CI from Gitlab CI to GitHub Actions
This commit is contained in:
Sam 2022-03-26 16:31:52 +01:00 committed by GitHub
commit 9ab07602e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 126 additions and 113 deletions

34
.github/workflows/.tests-javascript.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Javascript CI
on:
push:
paths: ['fittrackee_client/**']
pull_request:
paths: ['fittrackee_client/**']
env:
working-directory: fittrackee_client
jobs:
javascript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 17.x
uses: actions/setup-node@v2
with:
node-version: "17.x"
- name: Install yarn and dependencies
working-directory: ${{env.working-directory}}
run: |
npm install --global yarn
yarn install
- name: Lint
working-directory: ${{env.working-directory}}
run: yarn lint
- name: Tests
working-directory: ${{env.working-directory}}
run: yarn test:unit
- name: Build
working-directory: ${{env.working-directory}}
run: yarn build

86
.github/workflows/.tests-python.yml vendored Normal file
View File

@ -0,0 +1,86 @@
name: Python CI
on:
push:
paths-ignore: ['docs/**', 'docsrc/**', 'fittrackee_client/**', '*.md']
pull_request:
paths-ignore: ['docs/**', 'docsrc/**', 'fittrackee_client/**', '*.md']
env:
APP_SETTINGS: fittrackee.config.TestingConfig
DATABASE_TEST_URL: "postgresql://fittrackee:fittrackee@postgres:5432/fittrackee_test"
EMAIL_URL: "smtp://none:none@0.0.0.0:1025"
FLASK_APP: fittrackee/__main__.py
SENDER_EMAIL: fittrackee@example.com
jobs:
python:
name: python ${{ matrix.python-version }}
runs-on: ubuntu-latest
container: python:${{ matrix.python-version }}
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: fittrackee_test
POSTGRES_USER: fittrackee
POSTGRES_PASSWORD: fittrackee
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
steps:
- uses: actions/checkout@v2
- name: Install Poetry and Dependencies
run: |
python -m pip install --upgrade pip
pip install --quiet poetry
poetry config virtualenvs.create false
poetry install --no-interaction --quiet
- name: Lint
if: matrix.python-version == '3.10'
run: pytest --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore=fittrackee/migrations -p no:warnings
- name: Mypy
if: matrix.python-version == '3.10'
run: mypy fittrackee
- name: Pytest
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
end2end:
runs-on: ubuntu-latest
needs: ["python"]
container: python:3.10
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: fittrackee_test
POSTGRES_USER: fittrackee
POSTGRES_PASSWORD: fittrackee
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
selenium:
image: selenium/standalone-firefox
steps:
- uses: actions/checkout@v2
- name: Install Poetry and Dependencies
run: |
python -m pip install --upgrade pip
pip install --quiet poetry
poetry config virtualenvs.create false
poetry install --no-interaction --quiet
- name: Run migrations
run: flask db upgrade --directory fittrackee/migrations
- name: Start application and run tests with Selenium
run: |
setsid nohup flask run --with-threads -h 0.0.0.0 -p 5000 >> nohup.out 2>&1 &
export TEST_APP_URL=http://$(hostname --ip-address):5000
sleep 5
pytest e2e --driver Remote --capability browserName firefox --host selenium --port 4444

View File

@ -1,100 +0,0 @@
image: python:3.9
variables:
POSTGRES_DB: fittrackee_test
POSTGRES_USER: fittrackee
POSTGRES_PASSWORD: fittrackee
POSTGRES_HOST: postgres
APP_SETTINGS: fittrackee.config.TestingConfig
DATABASE_TEST_URL: postgresql://fittrackee:fittrackee@postgres:5432/fittrackee_test
EMAIL_URL: smtp://none:none@0.0.0.0:1025
FLASK_APP: fittrackee/__main__.py
SENDER_EMAIL: fittrackee@example.com
services:
- name: postgres:latest
alias: postgres
stages:
- lint
- tests
- selenium
.python:
stage: tests
before_script:
- pip install --quiet poetry
- poetry config virtualenvs.create false
- poetry install --no-interaction --quiet
script:
- pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
.javascript:
stage: tests
before_script:
- apt-get update && apt-get install -y nodejs npm
- npm install --global yarn
- cd fittrackee_client
- yarn install
python-lint:
stage: lint
extends: .python
script:
- pytest --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore=fittrackee/migrations
python-type-check:
stage: lint
extends: .python
script:
- mypy fittrackee
eslint:
stage: lint
extends: .javascript
script:
- yarn lint
python-3.7:
extends: .python
image: python:3.7
python-3.8:
extends: .python
image: python:3.8
python-3.9:
extends: .python
python-3.10:
extends: .python
image: python:3.10
typescript:
stage: tests
before_script:
- apt-get update && apt-get install -y nodejs npm
- npm install --global yarn
- cd fittrackee_client
- yarn install
script:
- yarn test:unit
firefox:
stage: selenium
services:
- name: postgres:latest
alias: postgres
- name: selenium/standalone-firefox
alias: selenium
before_script:
- pip install --quiet poetry
- poetry config virtualenvs.create false
- poetry install --no-interaction --quiet
- flask db upgrade --directory fittrackee/migrations
- setsid nohup flask run --with-threads -h 0.0.0.0 -p 5000 >> nohup.out 2>&1 &
- export TEST_APP_URL=http://$(hostname --ip-address):5000
- sleep 5
script:
- pytest e2e --driver Remote --capability browserName firefox --host selenium --port 4444

View File

@ -20,8 +20,6 @@ The **GitHub** repository contains:
- tests,
- documentation (source and build).
Continuous integration pipeline runs on **Gitlab CI**.
### How to install FitTrackee
see [Installations instructions](https://samr1.github.io/FitTrackee/installation.html)
@ -54,12 +52,10 @@ Please make your changes from the development branch (`dev`).
```shell
$ make check-all
```
There are some end-to-end tests, to run them:
There are some end-to-end tests, to run them (needs a running application):
```shell
$ make test-e2e
```
Note: For now, pull requests from forks don't trigger pipelines on GitLab CI (see [current issue](https://gitlab.com/gitlab-org/gitlab/-/issues/5667)).
So make sure that checks don't return errors locally.
* If needed, add or update tests.
@ -74,5 +70,7 @@ Please make your changes from the development branch (`dev`).
* Ensure the pull requests description clearly describes the problem and solution. Include the relevant issue number if applicable.
* If needed, [update your branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch).
Thanks.

View File

@ -9,9 +9,9 @@
[![Vue Version](https://img.shields.io/badge/vue-3.2-brightgreen.svg)](https://v3.vuejs.org/)
[![Typescript Version](https://img.shields.io/npm/types/typescript)](https://www.typescriptlang.org/)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/290a285f22e94132904dc13b4dd19d1d)](https://www.codacy.com/app/SamR1/FitTrackee)
[![pipeline status](https://gitlab.com/SamR1/FitTrackee/badges/master/pipeline.svg)](https://gitlab.com/SamR1/FitTrackee/-/commits/master)
[![coverage report](https://gitlab.com/SamR1/FitTrackee/badges/master/coverage.svg)](https://gitlab.com/SamR1/FitTrackee/-/commits/master) <sup><sup>1</sup></sup>
![pipeline status](https://github.com/SamR1/FitTrackee/actions/workflows/.tests-python.yml/badge.svg?branch=master)
![pipeline status](https://github.com/SamR1/FitTrackee/actions/workflows/.tests-javascript.yml/badge.svg?branch=master)
---
@ -30,8 +30,3 @@ It is also possible to add a workout without a gpx file.
(see [issues](https://github.com/SamR1/FitTrackee/issues) and [documentation](https://samr1.github.io/FitTrackee) for more information)
![FitTrackee Dashboard Screenshot](https://samr1.github.io/FitTrackee/_images/fittrackee_screenshot-01.png)
---
Notes:
_1. Test coverage: only for Python API_