Bump actions/upload-artifact from 3 to 4 #87
Workflow file for this run
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
name: CI/CD | |
on: | |
- pull_request | |
- push | |
- workflow_dispatch | |
jobs: | |
run-pytest: | |
name: Run pytest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade poetry | |
poetry install --with test | |
- name: Run tests | |
run: | | |
poetry run pytest | |
build-package: | |
name: Build package | |
needs: run-pytest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade poetry | |
poetry install | |
- name: Build package | |
run: | | |
poetry build --no-interaction | |
- name: Upload package artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
test-docker-image: | |
name: Test Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: docker build . -t nettacker | |
- name: Test help menu | |
run: | | |
docker run -e github_ci=true --rm nettacker \ | |
poetry run python nettacker.py --help | |
- name: Test help menu in Persian | |
run: | | |
docker run -e github_ci=true --rm nettacker \ | |
poetry run python nettacker.py --help -L fa | |
- name: Show all modules | |
run: | | |
docker run -e github_ci=true --rm nettacker \ | |
poetry run python nettacker.py --show-all-modules | |
- name: Show all profiles | |
run: | | |
docker run -e github_ci=true --rm nettacker \ | |
poetry run python nettacker.py --show-all-profiles | |
- name: Test all modules command + check if it's finish successfully + csv | |
run: | | |
docker run -e github_ci=true --rm -i nettacker \ | |
poetry run python nettacker.py -i 127.0.0.1 -u user1,user2 -p pass1,pass2 -m all -g 21,25,80,443 \ | |
-t 1000 -T 3 -o out.csv | |
- name: Test all modules command + check if it's finish successfully + csv | |
run: | | |
docker run -e github_ci=true --rm -i nettacker \ | |
poetry run python nettacker.py -i 127.0.0.1 -u user1,user2 -p pass1,pass2 -m all -g 21,25,80,443 \ | |
-t 1000 -T 3 -o out.csv --skip-service-discovery | |
- name: Test all modules command + check if it's finish successfully + with graph + Persian | |
run: | | |
docker run -e github_ci=true --rm -i nettacker \ | |
poetry run python nettacker.py -i 127.0.0.1 -L fa -u user1,user2 -p pass1,pass2 --profile all \ | |
-g 21,25,80,443 -t 1000 -T 3 --graph d3_tree_v2_graph -v | |
- name: Test all modules command + check if it's finish successfully + with graph + Persian | |
run: | | |
docker run -e github_ci=true --rm -i nettacker \ | |
poetry run python nettacker.py -i 127.0.0.1 -L fa -u user1,user2 -p pass1,pass2 --profile all \ | |
-g 21,25,80,443 -t 1000 -T 3 --graph d3_tree_v2_graph -v --skip-service-discovery | |
publish-to-docker-registry: | |
name: Publish Docker image | |
needs: | |
- test-docker-image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: owasp/nettacker:dev | |
publish-to-test-pypi: | |
name: Publish Test PyPI package | |
if: | | |
github.repository == 'owasp/nettacker' && | |
github.event_name == 'push' && | |
github.ref_name == 'master' | |
environment: dev | |
needs: | |
- build-package | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get package artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Publish package distributions to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |