File size: 6,599 Bytes
0e1a481 13ced77 72251db 13ced77 0e1a481 92f0a3d d88ad14 618fdc2 ae7c0d4 618fdc2 ae7c0d4 618fdc2 ae7c0d4 618fdc2 ae7c0d4 618fdc2 ae7c0d4 5a2a8c2 618fdc2 13ced77 5a2a8c2 13ced77 618fdc2 ae7c0d4 618fdc2 42dc97c 618fdc2 5a2a8c2 618fdc2 5a2a8c2 618fdc2 5a2a8c2 9360932 ae7c0d4 9360932 13ced77 9360932 13ced77 9360932 42dc97c ae7c0d4 42dc97c 9360932 618fdc2 9360932 13ced77 ae7c0d4 9360932 42dc97c 9360932 42dc97c 9360932 42dc97c 9360932 618fdc2 ae7c0d4 31471a4 618fdc2 31471a4 618fdc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# Copyright Jiaqi Liu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
name: CI/CD
"on":
pull_request:
push:
branches:
- master
env:
PYTHON_VERSION: "3.10"
NEO4J_ENTERPRISE_VERSION: 5.24-enterprise
NEO4J_URI: neo4j://localhost:7687
NEO4J_DATABASE: neo4j
NEO4J_USERNAME: not used
NEO4J_PASSWORD: not used
jobs:
cancel-previous:
name: Cancel Previous Runs In Order to Allocate Action Resources Immediately for Current Run
runs-on: ubuntu-latest
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.10.1
with:
access_token: ${{ github.token }}
yaml-lint:
name: YAML Style Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actionshub/yamllint@main
linkChecker:
name: Link Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Link Checker
uses: lycheeverse/lychee-action@v1.9.0
with:
fail: true
code-style:
name: Python Code Style Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Check import orders
run: isort --check .
- name: pep8
run: pycodestyle .
unit-tests:
name: Unit Tests
needs: [yaml-lint, linkChecker, code-style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Run tests
run: python -m unittest
sync-to-huggingface-space:
needs: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Generate Hugging Face Datasets
run: |
cd huggingface
python3 ./generate_datasets.py
- name: Push to hub
if: github.ref == 'refs/heads/master'
run: |
git config --global user.name "QubitPi"
git config --global user.email "jack20220723@gmail.com"
git lfs install
git lfs track "*-graph-data.jsonl"
git add *-graph-data.jsonl
git commit -m "Generate Hugging Face Datasets"
git push https://QubitPi:$HF_TOKEN@huggingface.co/datasets/QubitPi/wilhelm-vocabulary master:main -f
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
docker:
name: Test Docker Build, Runs Acceptance Tests, and Publish Data Image to DockerHub
needs: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Startup a Neo4J database
run: |
docker run \
--publish=7474:7474 \
--publish=7687:7687 \
--env=NEO4J_AUTH=none \
--env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes \
-e NEO4JLABS_PLUGINS=\[\"apoc\"\] \
--name data-loader \
neo4j:${{ env.NEO4J_ENTERPRISE_VERSION }} &
- name: Wait for database to be ready
uses: iFaxity/wait-on-action@v1
with:
resource: http://localhost:7474
- name: Load all languages into the intermediate container
run: |
git clone https://github.com/QubitPi/wilhelm-data-loader.git ../wilhelm-data-loader
cd ../wilhelm-data-loader
pip3 install -r requirements.txt
pip3 install -e .
python3 wilhelm_vocabulary/load_all_in_parallel.py
env:
NEO4J_URI: ${{ env.NEO4J_URI }}
NEO4J_DATABASE: ${{ env.NEO4J_DATABASE }}
NEO4J_USERNAME: ${{ env.NEO4J_USERNAME }}
NEO4J_PASSWORD: ${{ env.NEO4J_PASSWORD }}
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Run acceptance tests
run: behave
- name: Copy over data onto host
run: docker cp data-loader:/data .
- name: Test image build
uses: docker/build-push-action@v3
with:
context: .
push: false
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v2
with:
username: jack20191124
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: jack20191124/wilhelm-vocabulary:latest
- name: Push image Description
if: github.ref == 'refs/heads/master'
uses: peter-evans/dockerhub-description@v4
with:
username: jack20191124
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: jack20191124/wilhelm-vocabulary
readme-filepath: README.md
triggering:
name: Triggering data model acceptance tests CI/CD
needs: [sync-to-huggingface-space, docker]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Trigger wilhelm-data-loader to load all vocabularies into graph database
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.QUBITPI_DOWNSTREAM_CICD_TRIGGERING_TOKEN }}
repository: QubitPi/wilhelm-data-loader
event-type: wilhelm-vocabulary-changes
|