Skip to content

Commit

Permalink
Merge pull request #554 from populationgenomics/dev
Browse files Browse the repository at this point in the history
Metamist release
  • Loading branch information
illusional authored Sep 20, 2023
2 parents f77c075 + b95ca51 commit 331eb25
Show file tree
Hide file tree
Showing 59 changed files with 1,020 additions and 805 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- main
- dev

permissions:
id-token: write
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
Expand All @@ -21,23 +25,28 @@ jobs:
run:
shell: bash -eo pipefail -l {0}
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v3

- name: "gcloud setup"
uses: google-github-actions/setup-gcloud@v0
- id: "google-cloud-auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
project_id: sample-metadata
service_account_key: ${{ secrets.GCP_SERVER_DEPLOY_KEY }}
workload_identity_provider: "projects/774248915715/locations/global/workloadIdentityPools/gh-deploy-pool/providers/gh-provider"
service_account: "[email protected]"

- id: "google-cloud-sdk-setup"
name: "Set up Cloud SDK"
uses: google-github-actions/setup-gcloud@v1

- name: "gcloud docker auth"
run: |
gcloud auth configure-docker australia-southeast1-docker.pkg.dev
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.10"

- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
Expand Down
40 changes: 35 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,52 @@ on: push
jobs:
lint:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
# used for generating API
SM_DOCKER: samplemetadata:dev
defaults:
run:
shell: bash -eo pipefail -l {0}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"

- name: Install packages
- uses: actions/setup-java@v2
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"

- name: Setup build env
run: |
set -euxo pipefail
pip install -r requirements-dev.txt
pip install -r requirements.txt
# openapi-generator
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar -O openapi-generator-cli.jar
- name: "build image"
run: |
docker build \
--build-arg SM_ENVIRONMENT=local \
--tag $SM_DOCKER \
-f deploy/api/Dockerfile \
.
- name: Build + install packages
run: |
export OPENAPI_COMMAND="java -jar openapi-generator-cli.jar"
python regenerate_api.py
pip install -r requirements-dev.txt
pip install .
mkdir .mypy_cache
- name: pre-commit
run: pre-commit run --all-files
12 changes: 6 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
run:
shell: bash -eo pipefail -l {0}
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.10"

- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
Expand Down Expand Up @@ -70,10 +70,10 @@ jobs:
rc=$?
coverage xml
echo "::set-output name=rc::$rc"
echo "rc=$rc" >> $GITHUB_OUTPUT
- name: "Upload coverage report"
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml

Expand All @@ -89,7 +89,7 @@ jobs:
- name: Fail if tests are not passing
if: ${{ steps.runtests.outputs.rc != 0 }}
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
script: |
core.setFailed('Unit tests failed with rc = ${{ steps.runtests.outputs.rc }}')
174 changes: 90 additions & 84 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,92 +1,98 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
exclude: '\.*conda/.*'
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: '\.txt$|\.tsv$'
- id: check-case-conflict
- id: check-merge-conflict
- id: detect-private-key
- id: debug-statements
- id: check-added-large-files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
exclude: '\.*conda/.*'
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: '\.txt$|\.tsv$'
- id: check-case-conflict
- id: check-merge-conflict
- id: detect-private-key
- id: debug-statements
- id: check-added-large-files

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
hooks:
- id: markdownlint
args: ["--config", ".markdownlint.json"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
hooks:
- id: markdownlint
args: ["--config", ".markdownlint.json"]

- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
args: [.]
pass_filenames: false
always_run: true
exclude: ^metamist/
- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
args: [.]
pass_filenames: false
always_run: true
exclude: ^metamist/

- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear, flake8-quotes]
- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear, flake8-quotes]

# Using system installation of pylint to support checking python module imports
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
# Using system installation of pylint to support checking python module imports
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]

# mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
hooks:
- id: mypy
args:
[
--pretty,
--show-error-codes,
--no-strict-optional,
--ignore-missing-imports,
--install-types,
--non-interactive,
]
additional_dependencies:
- strawberry-graphql[fastapi]==0.138.1
# mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
args:
[
--pretty,
--show-error-codes,
--no-strict-optional,
--ignore-missing-imports,
--install-types,
--non-interactive,
--show-error-context,
--check-untyped-defs,
--explicit-package-bases,
--disable-error-code,
operator,
]
additional_dependencies:
- strawberry-graphql[fastapi]==0.206.0
- types-PyMySQL==1.1.0.1

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.4"
hooks:
- id: prettier
# I'm not exactly sure why it changes behaviour, but
# calling `cd web`, then calling `ls src/**/*.tsx`
# returns different results to `cd web && ls src/**/*.tsx`
# so just include both patterns here
entry: bash -c 'cd web && prettier --write --ignore-unknown --check src/*.{ts,tsx,css} src/**/*.{ts,tsx,css}'
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.4"
hooks:
- id: prettier
# I'm not exactly sure why it changes behaviour, but
# calling `cd web`, then calling `ls src/**/*.tsx`
# returns different results to `cd web && ls src/**/*.tsx`
# so just include both patterns here
entry: bash -c 'cd web && prettier --write --ignore-unknown --check src/*.{ts,tsx,css} src/**/*.{ts,tsx,css}'

- repo: https://github.com/pre-commit/mirrors-eslint
rev: "v8.33.0"
hooks:
- id: eslint
entry: bash -c 'cd web && eslint'
files: \.[jt]sx?$
types: [file]
additional_dependencies:
- eslint@^7.32.0
- eslint-config-airbnb@^19.0.4
- eslint-config-airbnb-base@^15.0.0
- eslint-config-airbnb-typescript@^17.0.0
- eslint-config-prettier@^8.6.0
- eslint-plugin-import@^2.26.0
- eslint-plugin-jsx-a11y@^6.6.1
- eslint-plugin-prettier@^4.2.1
- eslint-plugin-react@^7.31.11
- eslint-plugin-react-hooks@^4.6.0
- "@typescript-eslint/eslint-plugin@^5.48.0"
- "@typescript-eslint/parser@^5.48.0"
- repo: https://github.com/pre-commit/mirrors-eslint
rev: "v8.33.0"
hooks:
- id: eslint
entry: bash -c 'cd web && eslint'
files: \.[jt]sx?$
types: [file]
additional_dependencies:
- eslint@^7.32.0
- eslint-config-airbnb@^19.0.4
- eslint-config-airbnb-base@^15.0.0
- eslint-config-airbnb-typescript@^17.0.0
- eslint-config-prettier@^8.6.0
- eslint-plugin-import@^2.26.0
- eslint-plugin-jsx-a11y@^6.6.1
- eslint-plugin-prettier@^4.2.1
- eslint-plugin-react@^7.31.11
- eslint-plugin-react-hooks@^4.6.0
- "@typescript-eslint/eslint-plugin@^5.48.0"
- "@typescript-eslint/parser@^5.48.0"
Loading

0 comments on commit 331eb25

Please sign in to comment.