From 50238ff46e3773a19550f606d075119aa49b237a Mon Sep 17 00:00:00 2001 From: danniel Date: Mon, 24 Apr 2023 14:31:16 +0300 Subject: [PATCH] update release process --- .github/workflows/main.yaml | 45 ++++++++++++++++++++++++++++ .github/workflows/pull_requests.yaml | 38 +++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/main.yaml create mode 100644 .github/workflows/pull_requests.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..5d2fb4d --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,45 @@ +name: Build and push Docker Image to ECR + +on: + push: + branches: + - main + +env: + AWS_REGISTRY: "230690759643.dkr.ecr.eu-west-1.amazonaws.com" + REPOSITORY_NAME: "uv-system-consts-updater" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1-node16 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Install dependencies + run: | + pip install -r requirements.txt + + - name: Build Docker Image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: "${{ env.AWS_REGISTRY }}/${{ env.REPOSITORY_NAME }}:v${{ github.run_number }}" \ No newline at end of file diff --git a/.github/workflows/pull_requests.yaml b/.github/workflows/pull_requests.yaml new file mode 100644 index 0000000..14e6a58 --- /dev/null +++ b/.github/workflows/pull_requests.yaml @@ -0,0 +1,38 @@ +name: Pull Request + +on: + pull_request: + types: [opened, synchronize, reopened] + +env: + SYSTEM_CONSTS: system_consts.cfg + CALIBRATION_FILE: calibrationFile + KEYS_TO_COMPARE: HARDWARE_FINGERPRINT + DEFAULT: default + AUTHENTICATOR: http://uv-authenticator.uveye.svc.cluster.local:3000/auth-data + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + pip install -r requirements-dev.txt + + + - name: Run tests + run: | + python -m unittest discover -p '*_test.py' +