-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: replace Travis CI with GH Actions (#64)
* replaced travis ci with github actions Signed-off-by: Prati28 <[email protected]> * made some changes according to reviews Signed-off-by: Prati28 <[email protected]> * did some changes based on sourcery reviews Signed-off-by: Prati28 <[email protected]> * did some changes based on sourcery reviews Signed-off-by: Prati28 <[email protected]> * added py version Signed-off-by: Prati28 <[email protected]> * made some changes based on review Signed-off-by: Prati28 <[email protected]> * fix linting issue and py version Signed-off-by: Prati28 <[email protected]> * fix installation of package issue Signed-off-by: Prati28 <[email protected]> * fix command Signed-off-by: Prati28 <[email protected]> * added flask to requirements Signed-off-by: Prati28 <[email protected]> * added command for installation of packages Signed-off-by: Prati28 <[email protected]> * added github token Signed-off-by: Prati28 <[email protected]> * made changes Signed-off-by: Prati28 <[email protected]> --------- Signed-off-by: Prati28 <[email protected]>
- Loading branch information
Showing
7 changed files
with
413 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: drs-filer | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
branches: | ||
- main | ||
- dev | ||
|
||
jobs: | ||
publish_to_docker: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/dev' | ||
|
||
name: Build and publish to Docker | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: elixircloud/drs-filer | ||
|
||
- name: Build and push Docker images | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Lint workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
branches: | ||
- main | ||
- dev | ||
|
||
jobs: | ||
linting_and_tests: | ||
runs-on: ubuntu-latest | ||
|
||
name: Run linting and unit tests | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest coverage coveralls | ||
pip install -r requirements-test.txt | ||
pip install -r requirements.txt | ||
- name: Lint with flake8 | ||
run: flake8 | ||
|
||
- name: Run unit tests with coverage | ||
run: | | ||
coverage run --source drs_filer -m pytest | ||
coverage report -m | ||
- name: Send coverage data to Coveralls | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: coveralls |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Test Drs-filer API Endpoints | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Build and run Docker Compose | ||
run: docker-compose up --build -d | ||
|
||
- name: Wait for the services to be ready | ||
run: | | ||
echo "Waiting for the services to be ready..." | ||
for i in {1..10}; do | ||
if curl -sSf http://localhost:8080/ga4gh/drs/v1 > /dev/null; then | ||
echo "Service is up!" | ||
break | ||
fi | ||
echo "Waiting for the service to be ready..." | ||
sleep 3 | ||
done | ||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest requests | ||
- name: Test with pytest | ||
run: | | ||
pytest tests/test.py -v -p no:warnings | ||
env: | ||
DRS_FILER_URL: http://localhost:8080/ga4gh/drs/v1 | ||
|
||
- name: Stop and remove Docker Compose services | ||
run: docker-compose down |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
flask | ||
flake8 | ||
mongomock | ||
pytest | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ source = | |
drs_filer | ||
omit = | ||
drs_filer/app.py | ||
|
||
[flake8] | ||
max-line-length = 88 |
Oops, something went wrong.