try with another path #13
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-pipeline | |
on: | |
push: | |
branches: ["main", "**"] | |
# remove push when merge with main | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
env: | |
RELATIVE_PATH: ./relation_extraction | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.12.0 | |
- name: Install dependencies | |
run: | | |
echo "Installing dependencies" | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
echo "Testing..." | |
python -m unittest || exit 1 | |
#Run all test | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.12.0 | |
- name: Install dependencies | |
run: | | |
echo "Installing dependencies" | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Build if test pass | |
run: | | |
echo "Building project" | |
python3 main.py | |
working-directory: ${{ github.workspace }}/${{ env.RELATIVE_PATH }} | |
docker_build_and_deploy_image: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |