Skip to content

Commit

Permalink
github: add test and pre-commit workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
digorgonzola committed Feb 20, 2024
1 parent 406b0cb commit 2213048
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Run Pre-commit Checks

on:
pull_request:
branches:
- master

permissions:
id-token: write
contents: read

jobs:
pre_commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: pre-commit/[email protected]
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Test

on:
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
- '.github/environment/**'

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

permissions:
id-token: write
contents: read

jobs:
build_test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Setup Docker Structure Test
run: >
curl -LO
https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
&& chmod +x container-structure-test-linux-amd64 && sudo mv container-structure-test-linux-amd64
/usr/local/bin/container-structure-test
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Build Docker Image
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: image:${{ github.sha }}

- name: Test Docker Image
run: |
container-structure-test test --image image:${{ github.sha }} --config tests/config.yaml

0 comments on commit 2213048

Please sign in to comment.