Skip to content

Commit

Permalink
Merge pull request #1 from encX/docker
Browse files Browse the repository at this point in the history
CI & Docker
  • Loading branch information
encX authored Apr 3, 2022
2 parents 5342a86 + 1b730cd commit 7ad7486
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 29,756 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/runner-admin-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "[Runner Admin] CI"

on:
pull_request:
branches: [ main ]

jobs:
api-unit-test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: src

steps:
- uses: actions/checkout@v3

- run: >-
docker run
-v $(pwd):/src
-w /src
mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
dotnet test
GitLabKit.Runner.UnitTests/GitLabKit.Runner.UnitTests.csproj
--no-build
--collect:"XPlat Code Coverage"
client-lint:
runs-on: ubuntu-latest

defaults:
run:
working-directory: src/clientside

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: '16.x'

- name: Cache node_modules
uses: actions/cache@v1
with:
path: src/clientside/node_modules
key: gk-gra-yarn-${{ hashFiles('src/clientside/yarn.lock') }}
restore-keys: gk-gra-yarn-

- run: yarn
- run: yarn lint
49 changes: 49 additions & 0 deletions .github/workflows/runner-admin-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "[Runner Admin] Build & Publish docker image"

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

env:
IMAGE_NAME: encx/gitlabkit-runner
PUSH: ${{ github.event_name != 'pull_request' }}

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=pr
type=sha
labels: |
org.opencontainers.image.title=GitLabKit Runner
org.opencontainers.image.description=Tools for GitLab to help you visualize and manage self-hosted runners with ease
org.opencontainers.image.licenses=MIT
- name: Build and push
uses: docker/build-push-action@v2
with:
context: src
file: src/GitLabKit.Runner.Web/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Patipan Dujtipiya <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 0 additions & 2 deletions src/GitLabKit.Runner.Web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY NuGet.config ./
COPY *.sln ./
COPY ["GitLabKit.Runner.Web/GitLabKit.Runner.Web.csproj", "GitLabKit.Runner.Web/"]
COPY ["GitLabKit.Runner.Core/GitLabKit.Runner.Core.csproj", "GitLabKit.Runner.Core/"]
COPY docker-compose.dcproj ./
RUN dotnet restore "GitLabKit.Runner.Web/GitLabKit.Runner.Web.csproj"
COPY . .
WORKDIR /src/GitLabKit.Runner.Web
Expand Down
Loading

0 comments on commit 7ad7486

Please sign in to comment.