Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on:
push:
branches:
- main
# XXX: remove before merging
pull_request:

env:
DOCKERHUB_REPO: mozillaconduit/git-hg-sync
DOCKER_USER: ${{ vars.DOCKERHUB_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build -t git-hg-sync .
- name: Tag the image
run: |
[[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]] || exit 0
docker tag "$DOCKERHUB_REPO" "$DOCKERHUB_REPO:${{ github.sha }}"
docker push "$DOCKERHUB_REPO:${{ github.sha }}"
54 changes: 54 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deployment

on:
push:
branches:
- develop
- staging
- main
release:
types:
- published
# XXX: remove before merging
pull_request:

env:
IMAGE_NAME: git-hg-sync
GAR_LOCATION: us
GCP_PROJECT_ID: moz-fx-git-hg-sync-prod
GAR_REPOSITORY: git-hg-sync-prod

jobs:
deploy:
runs-on: ubuntu-latest
environment: build
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- uses: docker/setup-buildx-action@v2
- id: gcp-auth
name: Google authentication
uses: google-github-actions/auth@v2
with:
token_format: "access_token"
service_account: artifact-writer@${{ env.GCP_PROJECT_ID }}.iam.gserviceaccount.com
workload_identity_provider: ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.gcp-auth.outputs.access_token }}
- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
tags: |
${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE_NAME }}:develop
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
6 changes: 3 additions & 3 deletions .github/workflows/docker_compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pytest in docker compose
name: Tests in docker compose

on:
pull_request:
Expand All @@ -17,11 +17,11 @@ jobs:
mkdir tests_output
chmod a+w tests_output

- name: Run docker-compose
- name: Setup docker-compose
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: "docker-compose.yaml"

- name: Execute tests in the running services
run: |
docker compose run test
docker compose run test
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python
name: Tests

on:
pull_request:
Expand All @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip pytest pytest-mock
Expand All @@ -23,4 +23,4 @@ jobs:
echo "${{ github.workspace }}" >> $GITHUB_PATH
- name: Test with pytest
run: |
pytest --junitxml=pytest.xml
pytest --junitxml=pytest.xml