ci-post-land #4
Workflow file for this run
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: ci-post-land | |
on: | |
create: | |
branches: [main, release-*] | |
push: | |
branches: [main, release-*, gha-test-*] | |
defaults: | |
run: | |
shell: bash | |
env: | |
max_threads: 16 | |
pre_command: cd /opt/git/diem/ | |
jobs: | |
prepare: | |
runs-on: ubuntu-20.04 | |
outputs: | |
changes-target-branch: ${{ steps.changes.outputs.changes-target-branch }} | |
changes-base-git-rev: ${{ steps.changes.outputs.changes-base-git-rev }} | |
changes-base-githash: ${{ steps.changes.outputs.changes-base-githash }} | |
changes-pull-request-number: ${{ steps.changes.outputs.changes-pull-request-number }} | |
rust-changes: ${{ steps.rust-changes.outputs.changes-found }} | |
base-image-changes: ${{ steps.base-image-changes.outputs.changes-found }} | |
steps: | |
- uses: actions/[email protected] | |
with: | |
# This ensures that the tip of the PR is checked out instead of the merge between the base ref and the tip | |
# On `push` this value will be empty and will "do-the-right-thing" | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 #get all the history!!! | |
- name: Git Hooks and Checks | |
run: ./scripts/git-checks.sh | |
- id: changes | |
name: determine changes | |
uses: diem/actions/changes@faadd16607b77dfa2231a8f366883e01717b3225 | |
with: | |
workflow-file: ci-post-land.yml | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
- id: rust-changes | |
name: find rust/cargo changes. | |
uses: diem/actions/matches@faadd16607b77dfa2231a8f366883e01717b3225 | |
with: | |
pattern: '^documentation\|^docker\|^scripts\|^developers.diem.com' | |
invert: "true" | |
- id: base-image-changes | |
name: find dev-setup.sh/base docker image changes | |
uses: diem/actions/matches@faadd16607b77dfa2231a8f366883e01717b3225 | |
with: | |
pattern: '.github/workflows/ci-post-land.yml\|.github/actions/dockerhub_login/action.yml\|docker/ci/github/Dockerfile\|scripts/dev_setup.sh\|rust-toolchain' | |
build_ci_base_docker_image: | |
needs: prepare | |
runs-on: ubuntu-20.04-xl | |
if: ${{ needs.prepare.outputs.base-image-changes == 'true' || github.event_name == 'create' }} | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}_build_environment | |
IMAGE_TAG: ${{ needs.prepare.outputs.changes-target-branch }} | |
steps: | |
- uses: actions/[email protected] | |
with: | |
# This ensures that the tip of the PR is checked out instead of the merge between the base ref and the tip | |
# On `push` this value will be empty and will "do-the-right-thing" | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 #get all the history!!! | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build image | |
run: docker build -f docker/ci/github/Dockerfile -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} . | |
- name: Push to ghcr | |
run: | | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
# rustdoc: | |
# needs: prepare | |
# if: ${{ needs.prepare.outputs.changes-target-branch == 'main' && needs.prepare.outputs.rust-changes == 'true'}} | |
# runs-on: ubuntu-20.04 | |
# container: | |
# image: ghcr.io/diem/diem_build_environment:${{ needs.prepare.outputs.changes-target-branch }} | |
# volumes: | |
# - "${{github.workspace}}:/opt/git/diem" | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/[email protected] | |
# - uses: ./.github/actions/build-setup | |
# - uses: actions/[email protected] | |
# with: | |
# path: "/opt/cargo/git\n/opt/cargo/registry\n/opt/cargo/.package-cache" | |
# key: crates-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | |
# restore-keys: "crates-${{ runner.os }}" | |
# - name: Build Documentation | |
# # Build the rust crate docs | |
# # Use `RUSTC_BOOTSTRAP` in order to use the `--enable-index-page` flag of rustdoc | |
# # This is needed in order to generate a landing page `index.html` for workspaces | |
# run: cargo doc --no-deps --workspace --lib | |
# env: | |
# RUSTC_BOOTSTRAP: 1 | |
# RUSTDOCFLAGS: "-Z unstable-options --enable-index-page" | |
# CARGO_INCREMENTAL: 0 | |
# RUSTFLAGS: -D warnings | |
# - name: copy API specification doc into target/doc/diem_api | |
# run : cp api/doc/openapi.yaml target/doc/diem_api/openapi.yaml && cp api/doc/spec.html target/doc/diem_api/spec.html | |
# - name: Deploy Docs | |
# uses: peaceiris/[email protected] | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# publish_branch: gh-pages | |
# publish_dir: ./target/doc | |
# force_orphan: true |