Skip to content

Require approval before starting a CI run #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2021
Merged
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
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ name: Validate everything
push:
branches:
- master
pull_request:
pull_request_target:
types:
- labeled
branches:
- master
env:
DOCKER_HUB_USERNAME: shepmaster
GH_CONTAINER_REGISTRY_USERNAME: shepmaster
AWS_ACCESS_KEY_ID: AKIAWESVHZ3J6US4DSXP
AWS_ACCESS_KEY_ID: AKIAWESVHZ3JQAY5NM5K
jobs:
build_compiler_containers:
name: Build ${{ matrix.channel }} compiler container
Expand All @@ -22,11 +24,14 @@ jobs:
- stable
- beta
- nightly
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
env:
IMAGE_NAME: ghcr.io/integer32llc/rust-playground-ci-rust-${{ matrix.channel }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: "${{ github.event.pull_request.head.sha }}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
Expand Down Expand Up @@ -124,11 +129,14 @@ jobs:
- clippy
- miri
- rustfmt
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
env:
IMAGE_NAME: ghcr.io/integer32llc/rust-playground-ci-tool-${{ matrix.tool }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: "${{ github.event.pull_request.head.sha }}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -155,9 +163,12 @@ jobs:
build_backend:
name: Build backend
runs-on: ubuntu-latest
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: "${{ github.event.pull_request.head.sha }}"
- name: Cache Cargo intermediate products
uses: actions/cache@v2
with:
Expand All @@ -182,9 +193,12 @@ jobs:
build_frontend:
name: Build frontend
runs-on: ubuntu-latest
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: "${{ github.event.pull_request.head.sha }}"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand Down Expand Up @@ -214,6 +228,7 @@ jobs:
run_integration_tests:
name: Running integration tests
runs-on: ubuntu-latest
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
needs:
- build_compiler_containers
- build_tool_containers
Expand All @@ -225,6 +240,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: "${{ github.event.pull_request.head.sha }}"
- name: Configure Ruby
uses: actions/setup-ruby@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
---
name: Scheduled rebuild
'on':
workflow_dispatch:
workflow_dispatch:
schedule:
- cron: 7 2 * * *
env:
DOCKER_HUB_USERNAME: shepmaster
GH_CONTAINER_REGISTRY_USERNAME: shepmaster
AWS_ACCESS_KEY_ID: AKIAWESVHZ3J6US4DSXP
AWS_ACCESS_KEY_ID: AKIAWESVHZ3JQAY5NM5K
jobs:
build_compiler_containers:
name: Build ${{ matrix.channel }} compiler container
Expand Down
28 changes: 21 additions & 7 deletions ci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ components:
env:
DOCKER_HUB_USERNAME: shepmaster
GH_CONTAINER_REGISTRY_USERNAME: shepmaster
AWS_ACCESS_KEY_ID: AKIAWESVHZ3J6US4DSXP
AWS_ACCESS_KEY_ID: AKIAWESVHZ3JQAY5NM5K

- checkout: &checkout
name: "Checkout code"
uses: actions/checkout@v2

# This should only be used when we know that the code being tested
# doesn't make use of our secrets or elevated GitHub token.
- checkout_pr: &checkout_pr
name: "Checkout code"
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- docker_buildx: &docker_buildx
name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v1
Expand Down Expand Up @@ -212,7 +220,8 @@ workflows:
push:
branches:
- master
pull_request:
pull_request_target:
types: [labeled]
branches:
- master

Expand All @@ -221,11 +230,12 @@ workflows:
jobs:
build_compiler_containers:
<<: *build_compiler_containers_job
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"
env:
<<: *build_compiler_containers_job_env

steps:
- *checkout
- *checkout_pr
- *docker_buildx
- *login_ghcr
- *build_compiler_containers_toolchain
Expand All @@ -236,21 +246,23 @@ workflows:

build_tool_containers:
<<: *build_tool_containers_job
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"
env:
<<: *build_tool_containers_job_env

steps:
- *checkout
- *checkout_pr
- *docker_buildx
- *login_ghcr
- *build_tool_containers_final

build_backend:
name: "Build backend"
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"

steps:
- *checkout
- *checkout_pr

- name: "Cache Cargo intermediate products"
uses: actions/cache@v2
Expand Down Expand Up @@ -290,9 +302,10 @@ workflows:
build_frontend:
name: "Build frontend"
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"

steps:
- *checkout
- *checkout_pr

- name: "Get yarn cache directory path"
id: yarn-cache-dir-path
Expand Down Expand Up @@ -336,6 +349,7 @@ workflows:
run_integration_tests:
name: "Running integration tests"
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"
needs:
- build_compiler_containers
- build_tool_containers
Expand All @@ -347,7 +361,7 @@ workflows:
working-directory: tests

steps:
- *checkout
- *checkout_pr

- name: "Configure Ruby"
uses: actions/setup-ruby@v1
Expand Down