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

[action] opimize workflow #566

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
84 changes: 51 additions & 33 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@ on: [push, pull_request]
name: Base GitHub Action for Check, Test and Lints

jobs:
#
check:
name: Check
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
#
check:
name: Check
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/cargo@v1
with:
command: check
Expand All @@ -33,16 +41,11 @@ jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- run: |
sudo apt update
sudo apt install -y libwebkit2gtk-4.0-dev \
Expand All @@ -54,7 +57,10 @@ jobs:
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- run: cargo build
- uses: actions-rs/cargo@v1
with:
command: build
args: --bin mega --bin libra
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
Expand All @@ -65,18 +71,12 @@ jobs:
test:
name: Tests
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- run: |
sudo apt-get update
sudo apt-get install -y git-lfs
git lfs install
git config --global user.email "[email protected]"
Expand All @@ -91,15 +91,11 @@ jobs:
doc:
name: Doc
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: doc
Expand All @@ -108,13 +104,35 @@ jobs:
fuse:
name: Fuse Lints
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
submodules: recursive
- uses: actions/checkout@v3
- run: sudo apt-get update && sudo apt-get install -y fuse3 libfuse3-dev
- run: cd ./scorpio && cargo clippy --all-targets --all-features -- -D warnings

moon-lint-and-build:
name: MOON Lint & Build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: ./moon/package.json

- name: Install dependencies
working-directory: ./moon
run: npm install

- name: Run ESLint
working-directory: ./moon
run: npm run lint

- name: Build Next.js application
working-directory: ./moon
run: npm run build
2 changes: 1 addition & 1 deletion moon/src/app/api/user/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const dynamic = 'force-dynamic' // defaults to auto

export async function GET(request: NextRequest) {
const session = await verifySession()
if (!session) return null
if (!session) return Response.json({});

const endpoint = process.env.MEGA_INTERNAL_HOST;
const cookieHeader = request.headers.get('cookie') || '';
Expand Down
2 changes: 1 addition & 1 deletion moon/src/app/api/user/ssh/[id]/delete/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const endpoint = process.env.MEGA_INTERNAL_HOST;

export async function POST(request: Request, { params }: { params: { id: string } }) {
const session = await verifySession()
if (!session) return null
if (!session) return Response.json({})

const cookieHeader = request.headers.get('cookie') || '';

Expand Down
4 changes: 2 additions & 2 deletions moon/src/app/api/user/ssh/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const endpoint = process.env.MEGA_INTERNAL_HOST;

export async function POST(request: NextRequest) {
const session = await verifySession()
if (!session) return null
if (!session) return Response.json({})

const cookieHeader = request.headers.get('cookie') || '';
const body = await request.json();
Expand All @@ -33,7 +33,7 @@ export async function POST(request: NextRequest) {

export async function GET(request: NextRequest) {
const session = await verifySession()
if (!session) return null
if (!session) return Response.json({})

const cookieHeader = request.headers.get('cookie') || '';

Expand Down
Loading