|
| 1 | +name: Network Security CI/CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, master ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + - name: Set up Python 3.9 |
| 15 | + uses: actions/setup-python@v2 |
| 16 | + with: |
| 17 | + python-version: 3.9 |
| 18 | + - name: Install dependencies |
| 19 | + run: | |
| 20 | + python -m pip install --upgrade pip |
| 21 | + pip install -r requirements.txt |
| 22 | + pip install -e . |
| 23 | + - name: Run tests |
| 24 | + run: | |
| 25 | + pytest --cov=networksecurity |
| 26 | + - name: Upload coverage report |
| 27 | + uses: codecov/codecov-action@v1 |
| 28 | + |
| 29 | + dvc-tracking: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + needs: test |
| 32 | + if: github.event_name == 'push' |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v2 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + - name: Set up Python 3.9 |
| 38 | + uses: actions/setup-python@v2 |
| 39 | + with: |
| 40 | + python-version: 3.9 |
| 41 | + - name: Install dependencies |
| 42 | + run: | |
| 43 | + python -m pip install --upgrade pip |
| 44 | + pip install -r requirements.txt |
| 45 | + pip install -e . |
| 46 | + - name: Setup DVC |
| 47 | + uses: iterative/setup-dvc@v1 |
| 48 | + - name: Configure DAGsHub credentials |
| 49 | + run: | |
| 50 | + echo "machine dagshub.com login austinLorenzMccoy password ${{ secrets.DAGSHUB_TOKEN }}" > $HOME/.netrc |
| 51 | + chmod 600 $HOME/.netrc |
| 52 | + - name: Pull DVC data |
| 53 | + run: | |
| 54 | + dvc remote add origin https://dagshub.com/austinLorenzMccoy/networkSecurity_project.dvc |
| 55 | + dvc pull |
| 56 | + - name: Run DVC pipeline |
| 57 | + run: dvc repro |
| 58 | + - name: Push DVC results |
| 59 | + run: dvc push |
| 60 | + - name: Log metrics to DAGsHub |
| 61 | + run: | |
| 62 | + pip install dagshub |
| 63 | + python -c "from dagshub import dagshub_logger; dagshub_logger(metrics_path='reports/metrics.json', hparams_path='reports/params.json')" |
| 64 | + env: |
| 65 | + DAGSHUB_USER: austinLorenzMccoy |
| 66 | + DAGSHUB_REPO: networkSecurity_project |
0 commit comments