Skip to content

Commit

Permalink
Merge pull request #107 from studentinovisad/as/ci/cicd
Browse files Browse the repository at this point in the history
chore: CI/CD and goodies
  • Loading branch information
aleksasiriski authored Dec 29, 2024
2 parents d954bc3 + ab72608 commit cc69895
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
liberapay: studentinovisad
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG]'
labels: 'bug'
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**What's your setup? (please complete the following information):**

- Version of the software [e.g. 1.2.3]
- Method of installation [e.g. docker]

**Docker compose file if used**

```yaml
# Your docker-compose.prod.yml goes here
```

**Your .env file without secrets**

```env
YOUR_DOT_ENV_GOES_HERE=
```

**Additional context**
Add any other context about the problem here.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Ask for adding a new feature
title: '[FEAT]'
labels: 'enhancement'
assignees: ''
---

**Describe your feature request**
A clear and concise description of what the feature request is.

**Screenshots**
If applicable, add screenshots to help explain your request.

**Additional context**
Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
- package-ecosystem: 'docker'
directory: '/'
schedule:
interval: 'weekly'
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
74 changes: 74 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CD

on:
push:
branches: ['main']
tags: ['v*.*.*']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME_POSTGRES: ${{ github.repository }}-postgres

jobs:
cd:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
PUBLIC_UI_VERSION: ${{ github.ref }}

steps:
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v3
with:
platforms: arm64,arm

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- uses: docker/build-push-action@v6
with:
context: .
file: ./docker/node.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: |-
linux/amd64
linux/arm64
linux/arm/v7
- uses: docker/metadata-action@v5
id: meta_postgres
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_POSTGRES }}

- uses: docker/build-push-action@v6
with:
context: .
file: ./docker/postgres.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_postgres.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: |-
linux/amd64
linux/arm64
linux/arm/v7
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
pull_request:
branches: ['*']

jobs:
ci:
runs-on: ubuntu-latest
permissions:
contents: read
env:
PUBLIC_UI_VERSION: ${{ github.ref }}
STAGE: build # Ugly workaround some build bug that tries to connect to the DB while bundling

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'

- name: Install dependencies
run: pnpm i --frozen-lockfile

- name: Build
run: pnpm run build

- name: Svelte check
run: pnpm run check

- name: Prettier and eslint checks
run: pnpm run lint

0 comments on commit cc69895

Please sign in to comment.