diff --git a/.github/workflows/lint-and-test.yaml b/.github/workflows/lint-and-test.yaml index 8325a29..603d059 100644 --- a/.github/workflows/lint-and-test.yaml +++ b/.github/workflows/lint-and-test.yaml @@ -2,9 +2,9 @@ name: Cargo Lint & Test on: push: - branches: ["main"] + branches: ['main'] pull_request: - branches: "*" + branches: '*' env: CARGO_TERM_COLOR: always @@ -39,6 +39,49 @@ jobs: run: | rustup component add clippy rustup component add rustfmt - - run: cargo fmt --all -- --check - - run: cargo clippy --workspace -- -D warnings - - run: cargo test --workspace + - name: Format Check + run: cargo fmt --all -- --check + - name: Lint Check + run: cargo clippy --workspace -- -D warnings + - name: Core Test + run: cargo test --workspace + + - name: Sync node version + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' + - name: Install frontend dependencies + run: npm install + + - name: Setup cache + uses: actions/cache@v3 + with: + path: | + ~/.npm + ${{ github.workspace }}/.next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + + - name: Test(GUI) + run: npm test + - name: Build Test(GUI) + run: npm run build + + - name: Compress output(Windows) + shell: pwsh + if: ${{ runner.os }} == 'Windows' + run: Compress-Archive ${{ github.workspace}}/target/debug/g_dar2oar.exe ./gui/g_dar2oar-${{ runner.os}}.zip + - name: Compress output(Unix) + shell: bash + if: ${{ runner.os }} != 'Windows' + run: tar -czvf ./gui/g_dar2oar-${{ runner.os}}.tar.gz ${{ github.workspace}}/target/debug/g_dar2oar + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3.1.3 + with: + name: DAR to OAR Converter(GUI)-${{runner.os}} + path: | + ${{ github.workspace}}/gui/