Skip to content

Enhance peers version handling (#579) #1443

Enhance peers version handling (#579)

Enhance peers version handling (#579) #1443

Workflow file for this run

name: Main
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]
concurrency:
# find the branch name for 'pull_request' or on 'push' events
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Lint and test code
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v25
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint with ruff
working-directory: ct-app
run: |
nix develop -c ruff check . --output-format=github --ignore E501 --target-version=py39
- name: Test with pytest
working-directory: ct-app
run: |
nix develop -c pytest test
image:
name: Build and push container image
timeout-minutes: 10
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Calculate environment variables
shell: sh
run: |
commit_hash="${{ github.event.pull_request.head.sha }}"
if [ -z "${commit_hash}" ]; then
echo "docker_tag=latest" >> $GITHUB_ENV
else
echo "docker_tag=`echo ${commit_hash} | cut -c1-7`" >> $GITHUB_ENV
fi
- name: Set up Google Cloud Credentials
id: auth
uses: google-github-actions/auth@v2
with:
token_format: "access_token"
credentials_json: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: hoprassociation
install_components: beta
- name: Login Google Container Registry
uses: docker/login-action@v3
with:
registry: europe-west3-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Build container image
uses: docker/build-push-action@v5
with:
push: true
context: ct-app
tags: europe-west3-docker.pkg.dev/hoprassociation/docker-images/cover-traffic:${{ env.docker_tag }}