From f4b0d527d7b6db8c87257ffe3bf79e873de279a4 Mon Sep 17 00:00:00 2001 From: Sam Der Date: Fri, 23 Feb 2024 16:05:54 -0800 Subject: [PATCH] Add Control Station and Pod Operation GitHub workflows (#15) * feat: github workflows * feat: add npm run build * Use 'run: cargo ...' instead of cargo action * Install Prettier * Use dtolnay/rust-toolchain in place of actions-rs --- .github/workflows/run-checks.yml | 88 +++++++++++++++++++++++++++++++ control-station/package-lock.json | 16 ++++++ control-station/package.json | 1 + 3 files changed, 105 insertions(+) create mode 100644 .github/workflows/run-checks.yml diff --git a/.github/workflows/run-checks.yml b/.github/workflows/run-checks.yml new file mode 100644 index 00000000..ed2cb595 --- /dev/null +++ b/.github/workflows/run-checks.yml @@ -0,0 +1,88 @@ +name: Run Checks + +on: + push: + branches: + - main + pull_request: + branches: + - main + +permissions: + contents: read + pull-requests: write + +jobs: + check-control-station: + name: Check Control Station + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./control-station + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install frontend dependencies + run: npm install + + - name: Format with Prettier + uses: EPMatt/reviewdog-action-prettier@v1 + with: + workdir: control-station/ + level: warning + reporter: github-pr-review + prettier_flags: src + + - name: Lint with ESLint (review) + uses: reviewdog/action-eslint@v1 + if: github.event_name == 'pull_request' + with: + workdir: control-station/ + level: error + reporter: github-pr-review + eslint_flags: src + + - name: Lint with ESLint (check) + uses: reviewdog/action-eslint@v1 + if: github.event_name == 'push' + with: + workdir: control-station/ + level: error + reporter: github-check + eslint_flags: src + + - name: Test building + run: npm run build + + check-pod-operation: + name: Check Pod Operation + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./pod-operation + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Get Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + + - name: Run cargo test + run: cargo test + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Lint pod operation + run: cargo clippy -- -D warnings + + - name: Build Pod Operation Program + run: cargo build diff --git a/control-station/package-lock.json b/control-station/package-lock.json index 7add2d55..25210d3d 100644 --- a/control-station/package-lock.json +++ b/control-station/package-lock.json @@ -22,6 +22,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", + "prettier": "3.2.5", "typescript": "^5.0.2", "vite": "^4.4.5" } @@ -2402,6 +2403,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", diff --git a/control-station/package.json b/control-station/package.json index 873e7f6d..e6a1fee4 100644 --- a/control-station/package.json +++ b/control-station/package.json @@ -24,6 +24,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", + "prettier": "3.2.5", "typescript": "^5.0.2", "vite": "^4.4.5" }