From 31df668f1bbaf776b2f5a0c05d4ab4dd15ca738f Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Wed, 20 Mar 2024 02:47:48 +0300 Subject: [PATCH 1/2] Don't build production binaries in the debug job --- .github/actions/message/action.yml | 2 ++ .github/actions/message/main.js | 3 +++ .github/workflows/CI.yaml | 2 +- .github/workflows/PR.yml | 4 +++- .github/workflows/build.yml | 9 ++++++--- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/actions/message/action.yml b/.github/actions/message/action.yml index 44170adf494..8b1813c0ad6 100644 --- a/.github/actions/message/action.yml +++ b/.github/actions/message/action.yml @@ -16,6 +16,8 @@ outputs: description: If enable macOS build. release: description: If enable release build. + production: + description: If enable production build. runs: using: node20 diff --git a/.github/actions/message/main.js b/.github/actions/message/main.js index 0294aca8803..7c7b86359c6 100644 --- a/.github/actions/message/main.js +++ b/.github/actions/message/main.js @@ -16,6 +16,7 @@ const DEPBOT = "[depbot]"; const WINDOWS_NATIVE = "E1-forcenatwin"; const MACOS = "E2-forcemacos"; const RELEASE = "E3-forcerelease"; +const PRODUCTION = "E4-forceproduction"; const SKIP_CI = "[skip-ci]"; const [owner, repo] = ["gear-tech", "gear"]; @@ -78,6 +79,7 @@ async function main() { const win_native = !skipCI && labels.includes(WINDOWS_NATIVE); const macos = !skipCI && labels.includes(MACOS); const release = !skipCI && labels.includes(RELEASE); + const production = !skipCI && labels.includes(PRODUCTION); // Set outputs core.setOutput("build", build); @@ -85,6 +87,7 @@ async function main() { core.setOutput("win-native", win_native); core.setOutput("macos", macos); core.setOutput("release", release); + core.setOutput("production", production); console.log("---"); console.log("build: ", build); diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 72148f84e2d..37d90b31545 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -28,7 +28,7 @@ jobs: macos: true win-native: true release: true - + production: true upload: if: github.event_name == 'push' && github.ref_name == 'master' runs-on: ubuntu-latest diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index bfef347cd75..d098774342a 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -2,7 +2,7 @@ name: PR on: pull_request: - branches: [master] + branches: [ master ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -31,6 +31,7 @@ jobs: win-native: ${{ steps.config.outputs.win-native }} macos: ${{ steps.config.outputs.macos }} release: ${{ steps.config.outputs.release }} + production: ${{ steps.config.outputs.production }} steps: - uses: actions/checkout@v4 with: @@ -68,3 +69,4 @@ jobs: macos: ${{ needs.status.outputs.macos == 'true' }} win-native: ${{ needs.status.outputs.win-native == 'true' }} release: ${{ needs.status.outputs.release == 'true' }} + production: ${{ needs.status.outputs.production == 'true' }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be9690f1b31..5db8660b7b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,9 @@ on: release: type: boolean default: false + production: + type: boolean + default: false workflow_dispatch: inputs: title: @@ -137,11 +140,11 @@ jobs: RUST_LOG: info - name: "Build: Production binaries" - if: ${{ github.event_name == 'push' && inputs.release }} + if: ${{ github.event_name == 'push' && inputs.release && inputs.production }} run: cargo build -p gear-cli -F cli --profile production - name: Prepare artifacts - if: ${{ github.event_name == 'push' && inputs.release }} + if: ${{ github.event_name == 'push' && inputs.release && inputs.production }} run: | mkdir -p artifact cd target/wasm32-unknown-unknown/release @@ -156,7 +159,7 @@ jobs: strip artifact/wasm-proc || true - name: Upload artifacts - if: ${{ github.event_name == 'push' && inputs.release }} + if: ${{ github.event_name == 'push' && github.event_name != 'pull_request' && inputs.release && inputs.production }} uses: actions/upload-artifact@v4 with: path: artifact From 393a8e0f5f5d757400b8211e9eda1a1e6de63c0e Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Wed, 20 Mar 2024 20:27:17 +0300 Subject: [PATCH 2/2] Update conditions --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5db8660b7b9..44a356dee89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -140,11 +140,11 @@ jobs: RUST_LOG: info - name: "Build: Production binaries" - if: ${{ github.event_name == 'push' && inputs.release && inputs.production }} + if: ${{ inputs.production && matrix.profile == 'release' }} run: cargo build -p gear-cli -F cli --profile production - name: Prepare artifacts - if: ${{ github.event_name == 'push' && inputs.release && inputs.production }} + if: ${{ inputs.production && matrix.profile == 'release' }} run: | mkdir -p artifact cd target/wasm32-unknown-unknown/release @@ -159,7 +159,7 @@ jobs: strip artifact/wasm-proc || true - name: Upload artifacts - if: ${{ github.event_name == 'push' && github.event_name != 'pull_request' && inputs.release && inputs.production }} + if: ${{ github.event_name == 'push' && inputs.production && matrix.profile == 'release' }} uses: actions/upload-artifact@v4 with: path: artifact