From 47140573e5c0f3993f26467a6e5a558572ab292b Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Mon, 24 Jun 2024 19:04:16 -0400 Subject: [PATCH] build: update github workflow, add test and build jobs (#179) --- .github/workflows/build.yml | 19 +++++++++++++++++++ .github/workflows/codeql.yml | 23 ++++++----------------- .github/workflows/test.yml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0eba3ad --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: Build container image + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build-docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Buildah Action + uses: redhat-actions/buildah-build@v2 + with: + image: quips + tags: ${{ github.sha }} + containerfiles: ./compose/django/Dockerfile diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8f8ccb0..22d6bdb 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,22 +1,11 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# name: "CodeQL" on: push: - branches: [ "master" ] + branches: [ "main" ] pull_request: # The branches below must be a subset of the branches above - branches: [ "master" ] + branches: [ "main" ] schedule: - cron: '37 22 * * 3' @@ -38,11 +27,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +45,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -69,6 +58,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..159d4dd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx install poetry + - uses: actions/setup-python@v5 + with: + cache: "poetry" + - run: poetry install --with dev + - run: poetry run ruff check . + - run: poetry run ruff format --check . + + unit-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx install poetry + - uses: actions/setup-python@v5 + with: + cache: "poetry" + - run: poetry install --with dev + - run: DJANGO_SETTINGS_MODULE=config.settings.test poetry run coverage run ./manage.py test