diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..988be76 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,82 @@ +name: Build +env: + ARGO_NAMESPACE: argo + ARGO_VERSION: v3.5.1 + CONTAINER_REGISTRY_URL1: 'ghcr.io/sciexp' + CONTAINER_REGISTRY_URL2: 'us.gcr.io/project/pipelines' + +on: + push: + branches: + - main + paths-ignore: ["docs/**", "**.md"] + pull_request: + branches: + - main + types: [opened, synchronize, ready_for_review] + paths-ignore: ["docs/**", "**.md"] + + workflow_dispatch: + inputs: + debug_enabled: + description: "Run with tmate.io debugging enabled" + required: true + type: boolean + default: false + workflow_call: + inputs: + debug_enabled: + description: "Run with tmate.io debugging enabled" + required: true + type: boolean + default: false + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v3.4.0 + with: + skip_after_successful_duplicate: 'true' + build: + needs: pre_job + if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + runs-on: sciexp-runners + steps: + - name: Setup Runner for Argo + run: | + cd $HOME + echo "Install argo" + curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz + gunzip argo-linux-amd64.gz + chmod +x argo-linux-amd64 + sudo mv ./argo-linux-amd64 /usr/local/bin/argo + argo version + - name: Setup tmate debug session + if: ${{ github.event.inputs.debug_enabled }} + uses: mxschmitt/action-tmate@v3 + - name: Check out repository code + uses: actions/checkout@v3 + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + - run: echo ${GITHUB_REPOSITORY} + - run: echo ${GITHUB_REPOSITORY_NAME_PART} + - run: echo ${GITHUB_SERVER_URL} + - run: echo ${GITHUB_REPOSITORY_OWNER_PART_SLUG} + - name: build + run: | + echo "commit sha $GITHUB_SHA" + argo version --short + argo submit .argo/build.yaml \ + --generate-name="${GITHUB_REPOSITORY_NAME_PART}-build-${GITHUB_SHA_SHORT}-" \ + -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ + -p branch="${GITHUB_REF_NAME}" \ + -p containerFilePath="containers/base.Dockerfile" \ + -p containerRegistryURL1="${CONTAINER_REGISTRY_URL1}/${GITHUB_REPOSITORY_NAME_PART}:${GITHUB_SHA_SHORT}" \ + -p containerRegistryURL2="${CONTAINER_REGISTRY_URL2}/${GITHUB_REPOSITORY_NAME_PART}:${GITHUB_SHA_SHORT}" \ + -p gitUrlNoProtocol="github.com/${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ + -p shortSha="${GITHUB_SHA_SHORT}" \ + --wait --log