Apply clang-format 18 #408
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: Publish Docker image | |
on: | |
push: | |
branches: [ main ] | |
env: | |
DISTRO: ubuntu | |
REGISTRY: ghcr.io | |
LOCAL_IMAGE_NAME: ${{ github.event.repository.name }}/ubuntu | |
FBPCS_LOCAL_IMAGE_NAME: fbpcs/onedocker | |
REGISTRY_IMAGE_NAME: ghcr.io/${{ github.repository }}/ubuntu | |
TEST_REGISTRY_IMAGE_NAME: ghcr.io/${{ github.repository }}/test/ubuntu | |
PL_CONTAINER_NAME: e2e_pl_container | |
PA_CONTAINER_NAME: e2e_pa_container | |
VERSION_TAG: latest-build | |
COORDINATOR_IMAGE_DEV: ghcr.io/facebookresearch/fbpcs/coordinator:dev | |
jobs: | |
test_and_push: | |
runs-on: [self-hosted, e2e_test_runner] | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Build fbpcf docker image | |
run: | | |
./build-docker.sh -u | |
- name: Sanity check fbpcf library (v1) | |
timeout-minutes: 3 | |
run: | | |
./run-sanity_check.sh -u -v 1 | |
working-directory: fbpcf/tests/github/ | |
- name: Sanity check fbpcf library (v2) | |
timeout-minutes: 3 | |
run: | | |
./run-sanity_check.sh -u -v 2 | |
working-directory: fbpcf/tests/github/ | |
- name: Run Edit Distance E2E Test | |
timeout-minutes: 10 | |
run: | | |
./run-edit_distance_validation.sh -u | |
working-directory: fbpcf/tests/github/ | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone latest stable fbpcs | |
run: | | |
git clone https://github.com/facebookresearch/fbpcs | |
cd fbpcs | |
git reset --hard $(curl \ | |
--header 'content-type: application/json' \ | |
"https://api.github.com/repos/facebookresearch/fbpcs/actions/workflows/12965519/runs?per_page=1&status=success&branch=main" | jq \ | |
".workflow_runs[0] .head_sha" | tr -d '"') | |
- name: Build fbpcs image (this uses the locally built fbpcf image as a dependency) | |
run: | | |
cd fbpcs | |
./build-docker.sh onedocker -t ${{ env.VERSION_TAG }} | |
- name: Tag fbpcf docker image | |
run: | | |
docker tag ${{ env.LOCAL_IMAGE_NAME }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} | |
- name: Push fbpcf image to registry | |
run: | | |
docker push --all-tags ${{ env.REGISTRY_IMAGE_NAME }} | |
- name: Create version string | |
id: create_version | |
uses: paulhatch/[email protected] | |
with: | |
tag_prefix: "v" | |
major_pattern: "((MAJOR))" | |
minor_pattern: "((MINOR))" | |
format: "${major}.${minor}.${patch}-pre${increment}" | |
- name: Add tag to commit | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ steps.create_version.outputs.version_tag }} | |
tag_prefix: "" | |
- name: Set output | |
id: vars | |
run: echo ::set-output name=ref::${GITHUB_REF##*/} | |
- name: Pull image for this commit from registry | |
run: | | |
docker pull ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} | |
- name: Tag Docker image | |
run: | | |
docker tag ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ steps.vars.outputs.ref }} | |
docker tag ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ steps.create_version.outputs.major }} | |
docker tag ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ steps.create_version.outputs.major }}.${{ steps.create_version.outputs.minor }} | |
docker tag ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ steps.create_version.outputs.major }}.${{ steps.create_version.outputs.minor }}.${{ steps.create_version.outputs.patch }} | |
docker tag ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ steps.create_version.outputs.version_tag }} | |
docker tag ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY_IMAGE_NAME }}:latest | |
- name: Push Docker image | |
run: | | |
docker push --all-tags ${{ env.REGISTRY_IMAGE_NAME }} | |
- name: Create release | |
uses: "actions/create-release@v1" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_name: ${{ steps.create_version.outputs.version_tag }} | |
tag_name: ${{ steps.create_version.outputs.version_tag }} | |
- name: Cleanup | |
run: | | |
# remove all images | |
docker image prune -af | |
# stop and remove all containers | |
docker kill $(docker ps -q) || echo "No running containers to stop." | |
docker rm $(docker ps -a -q) || echo "No containers to delete." |