Skip to content
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

Combine CI checks into one workflow #744

Merged
merged 2 commits into from
Jul 6, 2023
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
111 changes: 111 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Run CI Checks

on: pull_request

jobs:
review_dependabot_pr:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable Dependabot automation
uses: mozilla/syseng-pod/actions/dependabot-automerge@main

run_unit_tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
env:
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
LC_COLLATE: en_US.UTF8
LC_CTYPE: en_US.UTF8
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry==1.3.2
- uses: actions/setup-python@v4
with:
python-version: "3.11.1"
cache: "poetry"

- name: Install dependencies
run: poetry install

- name: Run tests
run: bin/test.sh
env:
CTMS_DB_URL: postgresql://postgres:postgres@172.17.0.1:5432/postgres
CTMS_SECRET_KEY: secret_${{ github.sha }}

build_production_image:
runs-on: ubuntu-latest
steps:

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

- name: Build production image
uses: docker/build-push-action@v2
with:
context: .
push: false
target: "production"
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}-test-build

run_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry==1.3.2
- uses: actions/setup-python@v4
with:
python-version: "3.11.1"
cache: "poetry"

- name: Install dependencies
run: poetry install
- run: bin/lint.sh
env:
CTMS_DB_URL: postgresql://user@localhost/
CTMS_SECRET_KEY: secret_${{ github.sha }}

run_integration_tests:
env:
DOCKER_COMPOSE: docker compose
POETRY_VIRTUALENVS_IN_PROJECT: 1
timeout-minutes: 10
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry==1.3.2
- uses: actions/setup-python@v4
with:
python-version: "3.11.1"
cache: "poetry"

- name: Build containers
run: make build

- name: Start containers
run: make setup

- name: Run tests
run: make integration-test
12 changes: 0 additions & 12 deletions .github/workflows/dependabot-automerge.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/integration-test.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/lint.yaml

This file was deleted.

53 changes: 0 additions & 53 deletions .github/workflows/test-build.yaml

This file was deleted.

25 changes: 8 additions & 17 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -118,36 +118,27 @@
}
],
"results": {
".github/workflows/lint.yaml": [
".github/workflows/ci.yaml": [
{
"type": "Secret Keyword",
"filename": ".github/workflows/lint.yaml",
"hashed_secret": "a2490b1a07aa4a72606afe91f2de20f8c524d779",
"is_verified": false,
"line_number": 21
}
],
".github/workflows/test-build.yaml": [
{
"type": "Secret Keyword",
"filename": ".github/workflows/test-build.yaml",
"filename": ".github/workflows/ci.yaml",
"hashed_secret": "afc848c316af1a89d49826c5ae9d00ed769415f3",
"is_verified": false,
"line_number": 13
"line_number": 22
},
{
"type": "Basic Auth Credentials",
"filename": ".github/workflows/test-build.yaml",
"filename": ".github/workflows/ci.yaml",
"hashed_secret": "afc848c316af1a89d49826c5ae9d00ed769415f3",
"is_verified": false,
"line_number": 38
"line_number": 49
},
{
"type": "Secret Keyword",
"filename": ".github/workflows/test-build.yaml",
"filename": ".github/workflows/ci.yaml",
"hashed_secret": "a2490b1a07aa4a72606afe91f2de20f8c524d779",
"is_verified": false,
"line_number": 39
"line_number": 50
}
],
"docs/developer_setup.md": [
Expand Down Expand Up @@ -194,5 +185,5 @@
}
]
},
"generated_at": "2023-06-26T14:42:22Z"
"generated_at": "2023-07-06T13:37:29Z"
}