Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): use self-hosted runner #92

Merged
merged 41 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6ddcac2
aw shit, here we go again
aaronleopold Mar 4, 2023
d43d96a
blindly testing
aaronleopold Mar 7, 2023
ca637f4
ugh
aaronleopold Mar 7, 2023
0b751cb
ugh x2
aaronleopold Mar 7, 2023
29d557c
ugh x3
aaronleopold Mar 7, 2023
8772fa4
could scream
aaronleopold Mar 7, 2023
13ec57f
:)
aaronleopold Mar 7, 2023
78f5d54
haha
aaronleopold Mar 7, 2023
5fb873c
???
aaronleopold Mar 7, 2023
0ee2155
HAHAHAHAHA
aaronleopold Mar 7, 2023
6b9df1d
stinky
aaronleopold Mar 7, 2023
490058e
smellz
aaronleopold Mar 7, 2023
f0f6f31
:angry:
aaronleopold Mar 7, 2023
8acb367
hmmm
aaronleopold Mar 7, 2023
e22096d
oops
aaronleopold Mar 7, 2023
645015d
y no werk :sad:
aaronleopold Mar 8, 2023
8a6895d
testing arm
aaronleopold Mar 8, 2023
075424c
Merge branch 'al/docker-caching' of https://github.com/aaronleopold/s…
aaronleopold Mar 8, 2023
c56f25c
testing arm oops
aaronleopold Mar 8, 2023
855a317
tweaks
aaronleopold Mar 9, 2023
ff2e3b2
tweaks
aaronleopold Mar 9, 2023
d6f2919
fix conditions
aaronleopold Mar 9, 2023
979accb
test cache
aaronleopold Mar 9, 2023
6051ad3
try fix cache
aaronleopold Mar 9, 2023
b867cac
try fix cache again
aaronleopold Mar 9, 2023
adc0b55
test cache again
aaronleopold Mar 9, 2023
1967a34
test just core change
aaronleopold Mar 9, 2023
2842dbc
try ignore
aaronleopold Mar 9, 2023
7d7de3c
pause on caching ig :sob:
aaronleopold Mar 10, 2023
1e81dc5
add cancelling?
aaronleopold Mar 10, 2023
ec4e3c4
hrm
aaronleopold Mar 10, 2023
dab7e79
ugh, figure something else out for cancelling...
aaronleopold Mar 10, 2023
1ae9b81
push up yesterdays stuff oops
aaronleopold Mar 10, 2023
6d4d9d3
ugh
aaronleopold Mar 10, 2023
7a50b42
ugh
aaronleopold Mar 10, 2023
bca9ab1
just for now
aaronleopold Mar 10, 2023
7c14f2c
sigh
aaronleopold Mar 10, 2023
66c4e46
HUH?
aaronleopold Mar 10, 2023
3c5715d
maybe?
aaronleopold Mar 10, 2023
da9fd53
wrapping this up
aaronleopold Mar 10, 2023
58dd3c0
wrapping this up x2
aaronleopold Mar 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ dist
static
apps/server/client
target
*.lock
*-lock.*
*.log
*.db
.git

# ignore contents in excess directories, some are kept only so cargo
# doesn't yell at me
Expand Down
37 changes: 37 additions & 0 deletions .github/actions/build-desktop/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Build Stump desktop app'
description: 'Compile the Stump desktop app'

inputs:
platform:
description: 'The plaform of the runner'
required: true

runs:
using: composite
steps:
- name: Checkout project
uses: actions/checkout@v3

# - name: Configure environment
# run: |
# if [[ ${{ inputs.platform }} == 'linux' || ${{ inputs.platform }} == 'windows' ]]; then
# echo "RUN_SETUP=false" >> $GITHUB_ENV
# else
# echo "RUN_SETUP=true" >> $GITHUB_ENV
# fi

- name: Setup rust
uses: ./.github/actions/setup-cargo

- name: Generate Prisma client
uses: ./.github/actions/setup-prisma

- name: Copy bundled web app
uses: actions/download-artifact@v3
with:
name: webapp
path: ./apps/desktop/dist

- name: Compile desktop app
shell: bash
run: cargo build --package stump_desktop --release
97 changes: 97 additions & 0 deletions .github/actions/build-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: 'Build docker image'
description: 'Build and load or push a tagged docker image for stump'

inputs:
username:
description: 'Username for docker login'
required: true
password:
description: 'Token for docker login'
required: true
load:
description: 'Set output-type to docker'
default: true
push:
description: 'Set output-type to registry'
default: false
tags:
description: 'List of tags to assigned to the image'
default: 'nightly'
platforms:
description: 'List of platforms to build'
required: true

runs:
using: composite
steps:
- name: Get commit short sha
run: echo "GIT_REV=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
shell: bash

- name: Format tags
run: |
echo "TAGS=$(echo ${{ inputs.tags }} | sed -e 's/,/,aaronleopold\/stump:/g' | sed -e 's/^/aaronleopold\/stump:/')" >> $GITHUB_ENV
shell: bash

- name: Setup rust
uses: ./.github/actions/setup-cargo

- name: Generate Prisma client
uses: ./.github/actions/setup-prisma

# TODO: uncomment once cache stuff is resolved...
# - name: Setup Docker layers cache
# uses: actions/cache@v3
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-

# We only need QEMU when an arm* platform is targeted
- name: Check QEMU requirement
id: check-qemu
run: |
if [[ ${{ inputs.platforms }} == *"arm"* ]]; then
echo "SETUP_QEMU=1" >> $GITHUB_OUTPUT
else
echo "SETUP_QEMU=0" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: ${{ steps.check-qemu.outputs.SETUP_QEMU == '1' }}

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

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Run buildx build
uses: docker/build-push-action@v4
with:
context: .
build-args: |
"GIT_REV=${{ env.GIT_REV }}"
file: scripts/release/Dockerfile
platforms: ${{ inputs.platforms }}
load: ${{ inputs.load }}
push: ${{ inputs.push }}
tags: ${{ env.TAGS }}
# TODO: uncomment once cache stuff is resolved...
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# https://github.com/docker/build-push-action/issues/252
# TODO: https://github.com/moby/buildkit/issues/1896
# TODO: uncomment once cache stuff is resolved...
# - name: Move buildx cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
# shell: bash
29 changes: 17 additions & 12 deletions .github/actions/build-server/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 'Compile rust'
description: 'Compile stump rust server'
name: 'Build Stump server'
description: 'Compile the Stump Rust server'

inputs:
platform:
description: 'runner plaform'
description: 'The plaform of the runner'
required: true

runs:
Expand All @@ -12,21 +12,26 @@ runs:
- name: Checkout project
uses: actions/checkout@v3

# - name: Configure environment
# run: |
# if [[ ${{ inputs.platform }} == 'linux' || ${{ inputs.platform }} == 'windows' ]]; then
# echo "RUN_SETUP=false" >> $GITHUB_ENV
# else
# echo "RUN_SETUP=true" >> $GITHUB_ENV
# fi

- name: Setup rust
uses: ./.github/actions/setup-system
uses: ./.github/actions/setup-cargo

- name: Generate Prisma client
uses: ./.github/actions/setup-prisma
- name: Download frontend

- name: Copy bundled web app
uses: actions/download-artifact@v3
with:
name: web
name: webapp
path: ./apps/server/dist

- name: Copy web app to tauri
run: cp -r ./apps/server/dist apps/desktop/dist
shell: bash

- name: Build server
- name: Compile server
shell: bash
run: cargo build --release
run: cargo build --package stump_server --release
27 changes: 20 additions & 7 deletions .github/actions/build-web/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
name: 'Build Web Application'
description: "Build web application and upload it's artifacts"
name: 'Compile Web Application'
description: 'Compile stump web'

runs:
using: 'composite'
using: composite
steps:
- name: Build
uses: ./.github/actions/compile-web
- name: Checkout project
uses: actions/checkout@v3

- name: Upload
- name: Setup pnpm
uses: ./.github/actions/setup-pnpm

- name: Install dependencies
shell: bash
run: pnpm install
working-directory: apps/web

- name: Build app
shell: bash
run: pnpm run build
working-directory: apps/web

- name: Upload bundle
uses: ./.github/actions/upload-artifact
with:
upload-name: web
upload-name: webapp
upload-path: apps/web/dist
20 changes: 0 additions & 20 deletions .github/actions/compile-web/action.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .github/actions/setup-cargo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ description: 'Install system dependencies and setup cache'
runs:
using: 'composite'
steps:
- name: Configure environment
run: |
if [[ ${{ runner.name }} == 'manjaro-az' || ${{ runner.os }} == 'Windows' ]]; then
echo "RUN_SETUP=false" >> $GITHUB_ENV
else
echo "RUN_SETUP=true" >> $GITHUB_ENV
fi
shell: bash

- name: System setup
if: ${{ env.RUN_SETUP == 'true' }}
shell: bash
run: CHECK_NODE=0 CHECK_CARGO=0 DEV_SETUP=0 ./scripts/system-setup.sh

Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup-prisma/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
key: ${{ runner.os }}-prisma-${{ hashFiles('**/schema.prisma') }}

- name: Generate Prisma client
working-directory: core
# working-directory: core
if: steps.cache-prisma.outputs.cache-hit != 'true'
shell: bash
run: cargo run -p prisma --release -- generate
run: cargo prisma generate --schema=./core/prisma/schema.prisma
1 change: 0 additions & 1 deletion .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: 'Upload Local'
description: 'Upload artifact to local action'

inputs:
# Upload
upload-name:
required: true
description: 'Name of the upload'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_nix.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build legacy Nix package on Ubuntu"
name: 'Stump Nix CI'

on:
push:
Expand All @@ -15,5 +15,5 @@ jobs:
- uses: cachix/install-nix-action@v17
- name: test
run: nix develop --command "pkg-config" "--libs" "--cflags" "gdk-3.0" "gdk-3.0 >= 3.22"
# - name: Building package
# - name: Building package
# run: nix develop --command pnpm core run setup && cargo check
50 changes: 10 additions & 40 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: Stump-CI
name: 'Stump Checks CI'

on:
pull_request:
push:
branches:
- main

# TODO: figure out how to use moon here.
jobs:
check-rust:
name: Rust checks
runs-on: ubuntu-latest
# TODO: remove this once I have my own, hosted runner...
if: github.ref == 'refs/heads/main'
runs-on: [self-hosted]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -26,52 +25,23 @@ jobs:
run: |
cargo fmt --all -- --check
cargo clippy -- -D warnings
- name: Run tests
run: |
cargo integration-tests
# TODO: fix the tests, then uncomment this
# - name: Run tests
# run: |
# cargo integration-tests

check-typescript:
name: TypeScript checks
runs-on: ubuntu-latest
runs-on: [self-hosted]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup pnpm and typescript
- name: Setup PNPM and TypeScript
uses: ./.github/actions/setup-pnpm

- name: lint
- name: Run TypeScript lints
run: pnpm lint

# - name: typecheck
# run: pnpm moon run :typecheck

# release:
# name: Release (${{ matrix.platform }})
# runs-on: ${{ matrix.platform }}
# # Release only runs on push to main. TODO: can I make this trigger on tag?
# if: github.event_name != 'pull_request'
# strategy:
# fail-fast: true
# matrix:
# platform: [ubuntu-latest, macos-latest, windows-latest]
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# override: true
# # TODO: clippy??
# components: rustfmt, rust-src

# # TODO: figure out caching for rust deps

# - name: Generate Prisma client
# uses: ./.github/actions/generate-prisma-client

# TODO: pnpm setup
# TODO: docker builds -> maybe this helps? https://github.com/devture/matrix-corporal/blob/master/.gitlab-ci.yml
Loading