From 4bc8f61bd09da0bd91279c76e5c7e7b55200466a Mon Sep 17 00:00:00 2001 From: Aditya Shastri Date: Fri, 25 Mar 2022 10:42:26 -0700 Subject: [PATCH] Set up PR-time workflow to check permission issue Summary: We want to double check that we can't actually write packages at PR time Differential Revision: D35148221 fbshipit-source-id: 28f97613b64301c5ae7bc7160bc4ca00a5e1fa89 --- .../continuous_tests_nonblocking.yml | 311 ++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 .github/workflows/continuous_tests_nonblocking.yml diff --git a/.github/workflows/continuous_tests_nonblocking.yml b/.github/workflows/continuous_tests_nonblocking.yml new file mode 100644 index 00000000..34925915 --- /dev/null +++ b/.github/workflows/continuous_tests_nonblocking.yml @@ -0,0 +1,311 @@ +name: PR-time tests + +on: + pull_request: + branches: [ main ] + +env: + DISTRO: ubuntu + REGISTRY: ghcr.io + FBPCF_LOCAL_IMAGE_NAME: ${{ github.event.repository.name }}/ubuntu + REGISTRY_IMAGE_NAME: ghcr.io/${{ github.repository }}/ubuntu + COORDINATOR_IMAGE_DEV: ghcr.io/facebookresearch/fbpcs/coordinator:dev + LOCAL_IMAGE_NAME: fbpcs/onedocker + 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 + +permissions: + contents: write + packages: write + +jobs: + build_docker: + runs-on: [self-hosted, e2e_test_runner] + + steps: + - uses: actions/checkout@v2 + + - name: Remove unused images + run: | + docker image prune -af + + - name: Build fbpcf docker image + run: | + ./build-docker.sh -u + + - name: Sanity check fbpcf library + timeout-minutes: 3 + run: | + ./run-millionaire-sample.sh -u + + - 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" | 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 docker image + run: | + docker tag ${{ env.LOCAL_IMAGE_NAME }}:${{ env.VERSION_TAG }} ${{ env.TEST_REGISTRY_IMAGE_NAME }}:${{ github.sha }} + docker tag ${{ env.LOCAL_IMAGE_NAME }}:${{ env.VERSION_TAG }} ${{ env.TEST_REGISTRY_IMAGE_NAME }}:${{ env.VERSION_TAG }} + docker tag ${{ env.LOCAL_IMAGE_NAME }}:${{ env.VERSION_TAG }} ${{ env.TEST_REGISTRY_IMAGE_NAME }}:test_image + + - name: Push image to test registry + run: | + docker push --all-tags ${{ env.TEST_REGISTRY_IMAGE_NAME }} + + private_attribution_e2e_test: + runs-on: [self-hosted, e2e_test_runner] + needs: build_docker + steps: + - uses: actions/checkout@v2 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pull coordinator image + run: | + docker pull ${{ env.COORDINATOR_IMAGE_DEV }} + + - name: Start container + run: | + ./start_container.sh ${{ env.PA_CONTAINER_NAME }} ${{ env.COORDINATOR_IMAGE_DEV }} + working-directory: fbpcf/tests/github/ + + - name: Attribution - Create Instance + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} create_instance + working-directory: fbpcf/tests/github/ + + - name: Attribution - Data validation + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} data_validation + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PA_CONTAINER_NAME }} attribution + working-directory: fbpcf/tests/github/ + + - name: Attribution - Id Match + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} run_next + working-directory: fbpcf/tests/github/ + + - name: Check status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PA_CONTAINER_NAME }} attribution + working-directory: fbpcf/tests/github/ + + - name: Attribution - PID export metrics + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} pid_metric_export + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PA_CONTAINER_NAME }} attribution + working-directory: fbpcf/tests/github/ + + - name: Attribution - Prepare Compute Input + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} prepare_compute_input + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PA_CONTAINER_NAME }} attribution + working-directory: fbpcf/tests/github/ + + - name: Attribution - PCF2 Attribution + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} run_next + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PA_CONTAINER_NAME }} attribution + working-directory: fbpcf/tests/github/ + + - name: Attribution - PCF2 Aggregation + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} run_next + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PA_CONTAINER_NAME }} attribution + working-directory: fbpcf/tests/github/ + + - name: Attribution - Aggregate Shards + run: | + ./attribution_run_stages.sh ${{ env.PA_CONTAINER_NAME }} run_next + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PA_CONTAINER_NAME }} attribution + working-directory: fbpcf/tests/github/ + + - name: Attribution - Validate Result + run: | + ./validate_result.sh attribution + working-directory: fbpcf/tests/github/ + + - name: Cleanup + run: | + docker stop ${{ env.PA_CONTAINER_NAME }} + docker rm ${{ env.PA_CONTAINER_NAME }} + + + private_lift_e2e_test: + runs-on: [self-hosted, e2e_test_runner] + needs: build_docker + steps: + - uses: actions/checkout@v2 + + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pull coordinator image + run: | + docker pull ${{ env.COORDINATOR_IMAGE_DEV }} + + - name: Start container + run: | + ./start_container.sh ${{ env.PL_CONTAINER_NAME }} ${{ env.COORDINATOR_IMAGE_DEV }} + working-directory: fbpcf/tests/github/ + + - name: Lift - Create Instance + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} create_instance + working-directory: fbpcf/tests/github/ + + - name: Lift - Data validation + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} data_validation + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - Pid shard + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} pid_shard + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - Pid prepare + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} pid_prepare + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - Id Match + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} run_next + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - PID export metrics + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} pid_metric_export + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - Prepare Compute Input + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} prepare_compute_input + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - Compute Metrics + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} run_next + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - Aggregate Shards + run: | + ./lift_run_stages.sh ${{ env.PL_CONTAINER_NAME }} run_next + working-directory: fbpcf/tests/github/ + + - name: Check Status + timeout-minutes: 5 + run: | + ./check_status.sh ${{ env.PL_CONTAINER_NAME }} lift + working-directory: fbpcf/tests/github/ + + - name: Lift - Validate Results + run: | + ./validate_result.sh lift + working-directory: fbpcf/tests/github/ + + - name: Cleanup + run: | + docker stop ${{ env.PL_CONTAINER_NAME }} + docker rm ${{ env.PL_CONTAINER_NAME }}