Skip to content

Commit

Permalink
feat(ci): initial GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
meysam81 committed Feb 7, 2024
1 parent 8c67883 commit 329d05b
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 84 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git*
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: ci

concurrency:
cancel-in-progress: ${{ ! (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) }}
group: ci-${{ github.ref_name }}-${{ github.event_name }}

on:
pull_request:
branches:
- $default-branch
push:
branches:
- $default-branch
tags:
- "v*"
schedule:
- cron: 30 0 */1 * *
workflow_dispatch:
release:
types:
- published

jobs:
build-pr:
if: github.event_name == 'pull_request'
permissions:
contents: read
packages: write
uses: licenseware/infrastructure/.github/workflows/build-docker.yml@v2
with:
context: .
image-name: ghcr.io/${{ github.repository }}
platforms: linux/amd64,linux/arm64
push: true
scout-cves: true
scout-compare: true
scout-comment-pr: true
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

build-edge:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
contents: read
packages: write
uses: licenseware/infrastructure/.github/workflows/build-docker.yml@v2
with:
context: .
image-name: ghcr.io/${{ github.repository }}
platforms: linux/amd64,linux/arm64
push: true
scout-cves: true
scout-compare: false
scout-comment-pr: false
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

checks:
if: contains(fromJSON('["push", "pull_request", "schedule"]'), github.event_name)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run linters
run: |
pip install -U pip pre-commit
pre-commit run -a
- if: failure() && github.ref_name != 'refs/heads/main'
name: Commit linting changes
uses: EndBug/add-and-commit@v9
with:
message: "chore: lint 🚨"
new_branch: ${{ github.head_ref || github.ref_name }}
- name: Install mypy
run: |
pip install -U pip 'mypy<2'
- name: Run mypy
run: |
echo -e "# mypy output\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "<details><summary>Expand</summary>\n\n\`\`\`bash" >> $GITHUB_STEP_SUMMARY
mypy | tee -a $GITHUB_STEP_SUMMARY
echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo -e "</details>\n\n" >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
secrets
6 changes: 0 additions & 6 deletions .hadolint.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ['--maxkb=600']
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-shebang-scripts-are-executable
exclude: .*templates/.*j2$
- id: check-yaml
args:
- --allow-multiple-documents
- id: detect-private-key
- id: detect-aws-credentials
- id: end-of-file-fixer
- id: name-tests-test
- id: file-contents-sorter
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: trailing-whitespace
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
- id: go-imports
- id: no-go-testing
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@commitlint/config-conventional"]
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG AZCOPY_VERSION
ARG GO_VERSION=1.19
ARG ALPINE_VERSION=3.18
ARG GO_VERSION=1.22
ARG ALPINE_VERSION=3.19
ARG TARGETARCH

FROM golang:$GO_VERSION-alpine$ALPINE_VERSION as build
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ $ docker run --rm -it -v $PWD/src:/src peterdavehello/azcopy:10.11.0 azcopy --ve

Unable to find image 'peterdavehello/azcopy:10.11.0' locally
10.11.0: Pulling from peterdavehello/azcopy
540db60ca938: Already exists
2bb029cc37b3: Pull complete
0706491099ca: Pull complete
540db60ca938: Already exists
2bb029cc37b3: Pull complete
0706491099ca: Pull complete
Digest: sha256:bf339591009673060633cf95c3339e386a3d4e187e206da116547ac081a0b375
Status: Downloaded newer image for peterdavehello/azcopy:10.11.0
azcopy version 10.11.0
Expand Down
9 changes: 0 additions & 9 deletions hooks/build

This file was deleted.

0 comments on commit 329d05b

Please sign in to comment.