Skip to content

Update the build job #213

Update the build job

Update the build job #213

name: Fireback product(s) test, build and deploy
env:
CI: false
TERM: dumb
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
on:
push:
branches:
- "v**"
- "main"
workflow_dispatch:
inputs:
# target:
# type: choice
# options:
# - ubuntu-x64
# - windows-x64
# - macosx
release_artifacts:
description: "Create a draft release"
required: false
default: false
type: boolean
# autodeploy:
# description: "Deploy the binaries after build"
# required: false
# default: true
# type: boolean
jobs:
deploy_github_release:
needs:
- build-windows
- build-ubuntu
- build-macos
- fireback-react
- fireback-react-native-android
- vscode-extension
- test-react-code-gen
name: deploy_github_release
if: ${{ inputs.release_artifacts == true }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get the version tag
id: get_version_tag
run: echo "tag_name=$(basename ${GITHUB_REF})" >> $GITHUB_ENV
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: true
prerelease: true
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ env.tag_name }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
- uses: actions/download-artifact@master
with:
name: artifacts-ubuntu
path: artifacts-ubuntu
- uses: actions/download-artifact@master
with:
name: artifacts-vscode
path: artifacts-vscode
- uses: actions/download-artifact@master
with:
name: artifacts-windows
path: artifacts-windows
- uses: actions/download-artifact@master
with:
name: artifacts-darwin
path: artifacts-darwin
- uses: actions/download-artifact@master
with:
name: artifacts-android-react-native
path: artifacts-android-react-native
- name: Upload fireback react native
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-android-react-native/app-release.apk
asset_name: fireback-react-native-android.apk
asset_content_type: application/apk
- name: upload mac amd64 zip artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-darwin/fireback-server-all/fireback_amd64_darwin.zip
asset_name: fireback_amd64_darwin.zip
asset_content_type: application/zip
- name: upload mac arm64 zip artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-darwin/fireback-server-all/fireback_arm64_darwin.zip
asset_name: fireback_arm64_darwin.zip
asset_content_type: application/zip
- name: upload vscode extension
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-vscode/fireback-vscode/fireback-tools.vsix
asset_name: fireback-tools.vsix
asset_content_type: application/vsix
- name: upload mac arm64 pkg artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-darwin/fireback-server-all/fireback_silicon_arm64.pkg
asset_name: fireback_silicon_arm64.pkg
asset_content_type: application/x-newton-compatible-pkg
- name: upload mac amd64 pkg artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-darwin/fireback-server-all/fireback_intel_amd64.pkg
asset_name: fireback_intel_amd64.pkg
asset_content_type: application/x-newton-compatible-pkg
- name: upload windows amd64 artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-windows/fireback-server-all/fireback_win_amd64_installer.msi
asset_name: fireback_win_amd64_installer.msi
asset_content_type: application/x-ms-installer
- name: upload windows arm64 artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-windows/fireback-server-all/fireback_win_arm64_installer.msi
asset_name: fireback_win_arm64_installer.msi
asset_content_type: application/x-ms-installer
- name: upload linux installer arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-ubuntu/fireback-server-all/fireback-arm64.deb
asset_name: fireback-arm64.deb
asset_content_type: application/vnd.debian.binary-package
- name: upload linux installer amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-ubuntu/fireback-server-all/fireback-amd64.deb
asset_name: fireback-amd64.deb
asset_content_type: application/vnd.debian.binary-package
- name: upload linux zip amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-ubuntu/fireback-server-all/fireback_amd64_linux.zip
asset_name: fireback_amd64_linux.zip
asset_content_type: application/zip
- name: upload linux zip arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-ubuntu/fireback-server-all/fireback_arm64_linux.zip
asset_name: fireback_arm64_linux.zip
asset_content_type: application/zip
- name: upload windows zip arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-ubuntu/fireback-server-all/fireback_arm64_windows.zip
asset_name: fireback_arm64_windows.zip
asset_content_type: application/zip
- name: upload windows zip amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts-ubuntu/fireback-server-all/fireback_amd64_windows.zip
asset_name: fireback_amd64_windows.zip
asset_content_type: application/zip
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Download PSCP.exe
run: Invoke-WebRequest https://the.earth.li/~sgtatham/putty/latest/w64/pscp.exe -OutFile pscp.exe
- name: Download wix installer tools
run: Invoke-WebRequest https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip -OutFile wix314-binaries.zip
- name: Create thirdparty directory
run: New-Item -ItemType Directory -Force -Path thirdparty/wix314-binaries
- name: Unzip file
run: Expand-Archive -Path wix314-binaries.zip -DestinationPath thirdparty/wix314-binaries
- name: List contents of thirdparty
run: Get-ChildItem -Path thirdparty
# - name: Download Winrar
# run: Invoke-WebRequest https://www.win-rar.com/fileadmin/winrar-versions/winrar/winrar-x32-621.exe -OutFile winrar-installer.exe
# - name: Install winrar
# run: .\winrar-installer.exe /S
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.1
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install the dependencies
run: cd modules/workspaces/codegen/react-new && npm i --force
- name: Build
run: cd cmd/fireback && make ui2
- name: Package windows
run: cd cmd/fireback && make wininstaller
- uses: actions/upload-artifact@master
with:
name: artifacts-windows
path: artifacts
## Test the module builder ./artifacts/fireback/f gen gof --def modules/workspaces/WorkspaceModule3.yml --relative-to /Users/ali/work/fireback --gof-module github.com/torabian/fireback
## Changes might break them
# - name: Build System Service
# run: cd backend && npm run fb:build:win
# - name: Package the windows
# run: .\cmd\fireback\msi\package-windows.bat
# - name: Package the software
# run: .\backend\cmd\fireback\windows-package.bat
# - name: Upload artifact
# if: ${{ inputs.autodeploy == true }}
# if: ${{ inputs.release_artifacts == true }}
# run: echo y | .\pscp.exe -pw "${{ secrets.DIGITAL_OCEAN_KEY }}" .\fireback_latest_windows.exe root@pixelplux.com:/var/www/html/fireback-artifacts
build-ubuntu:
# if: ${{ inputs.target == 'ubuntu-x64' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22
# - name: Install deps
# run: sudo apt-get update -y && sudo apt install -y sshpass
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install the dependencies
run: cd modules/workspaces/codegen/react-new && npm i --force
- name: Build the UI
run: cd cmd/fireback && make ui2
- name: Build and package deb files
run: cd cmd/fireback && make deb && make linux-zip
- name: Windows zip
run: cd cmd/fireback && make windows-zip
- name: Install debian file for x64
run: sudo dpkg -i artifacts/fireback-server-all/fireback-amd64.deb
- name: Make once more time
run: make
- name: Test if the regenerating fireback definitions is gonna work
run: make test_rebuild
- name: Refresh the direback dependencies
run: make refresh
# - name: Run fireback tests
# run: make test
- uses: actions/upload-artifact@master
with:
name: artifacts-ubuntu
path: artifacts
test-react-code-gen:
needs:
- build-ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/download-artifact@master
with:
name: artifacts-ubuntu
path: artifacts-ubuntu
- name: check artifacts
run: cd artifacts-ubuntu/fireback-server-all && ls -la
- name: install fireback globally
run: sudo dpkg -i artifacts-ubuntu/fireback-server-all/fireback-amd64.deb
- name: generate-sdk
run: fireback gen react --path clients/react-bed/src/sdk
- name: Test the react bed
run: cd clients/react-bed && npm i --force && npm run build
- name: regenerate SDKs
run: make rebuild-sdks-ci
- name: checkout yarn lock because it's unrelated
run: git checkout clients/react-bed/yarn.lock && git checkout modules/workspaces/codegen/react-new/yarn.lock
- name:
Check if the sdk generated is already committed to the codebase.
Fireback changes should not be out of sync with react.js and react native
SDK
run: |
git diff --exit-code
if [[ $(git diff --name-only) ]]; then
echo "Changes detected in the following files:"
git diff --name-only
exit 1
fi
fireback-npm:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"
- run: |
cd modules/workspaces/codegen/react-new/src/modules/fireback && npm version --no-git-tag-version 1.1.27-${{ github.sha }} && npm publish --tag=latest --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
# fireback-react-native-ios:
# runs-on: macos-latest
# steps:
# - name: check Xcode version
# run: /usr/bin/xcodebuild -version
# - name: checkout repository
# uses: actions/checkout@v3
# - name: Debug Workflow Variables
# run: |
# echo "CERTIFICATE_PATH: $CERTIFICATE_PATH"
# echo "PP_PATH: $PP_PATH"
# echo "KEYCHAIN_PATH: $KEYCHAIN_PATH"
# echo "P12_PASSWORD: $P12_PASSWORD"
# - name: Install the Apple certificate and provisioning profile
# env:
# BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
# P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
# PROVISION_PROFILES_BASE64: ${{ secrets.PROVISION_PROFILES_BASE64 }}
# KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
# run: |
# CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
# PP_ARCHIVE=$RUNNER_TEMP/mobile_pp.tgz
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# echo -n "$PROVISION_PROFILES_BASE64" | base64 --decode -o $PP_ARCHIVE
# security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
# security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# echo "P12_PASSWORD: $P12_PASSWORD"
# security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# security list-keychain -d user -s $KEYCHAIN_PATH
# mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
# tar xzvf $PP_ARCHIVE -C $RUNNER_TEMP
# for PROVISION in `ls $RUNNER_TEMP/*.mobileprovision`
# do
# UUID=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i $PROVISION)`
# cp $PROVISION ~/Library/MobileDevice/Provisioning\ Profiles/$UUID.mobileprovision
# done
# security find-identity -v -p codesigning
# ls -l ~/Library/MobileDevice/Provisioning\ Profiles
# - uses: actions/setup-node@v3
# with:
# node-version: '18'
# cache: 'yarn'
# - name: Clean workspace
# run: |
# git clean -ffdx
# npm cache clean --force
# - name: Clean Xcode Build
# run: |
# cd ios
# xcodebuild clean -workspace your_app.xcworkspace -scheme your_app
# - name: install yarn dependencies
# run: |
# cd ios
# yarn install
# - name: install Cocoapod dependencies
# run: |
# cd ios
# pod repo update
# pod install
# - name: build archive
# run: |
# cd ios
# xcodebuild -workspace your_app.xcworkspace \
# -scheme "your_app" \
# -sdk iphoneos \
# -configuration Release \
# -destination generic/platform=iOS \
# -archivePath $RUNNER_TEMP/your_app.xcarchive \
# archive
# - name: export ipa
# env:
# EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }}
# run: |
# EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist
# echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
# xcodebuild -exportArchive -archivePath $RUNNER_TEMP/your_app.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build
# - name: Upload application
# uses: actions/upload-artifact@v3
# with:
# name: app
# path: ${{ runner.temp }}/build
# retention-days: 3
fireback-react-native-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Run Yarn Install
run: |
cd modules/workspaces/codegen/react-native-new && npm i
- name: Build application
run: |
cd modules/workspaces/codegen/react-native-new/android && \
./gradlew assembleRelease
- name: Upload application
uses: actions/upload-artifact@master
with:
name: artifacts-android-react-native
path: modules/workspaces/codegen/react-native-new/android/app/build/outputs/apk/release
fireback-react:
# if: ${{ inputs.target == 'fireback-react' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- run: cd docs && npm i --force && npm run build
name: Build the docs
- name: Build the front-end
run: cd modules/workspaces/codegen/react-new && npm i --force && ./node_modules/.bin/env-cmd -f ./src/apps/projectname/.env.fbgithubpages ./node_modules/.bin/craco build
- name: Copy docs to front-end build
run: cp -R docs/build modules/workspaces/codegen/react-new/build/docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./modules/workspaces/codegen/react-new/build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main' # Only deploy if on main branch
with:
folder: ./modules/workspaces/codegen/react-new/build # The folder the action should deploy.
vscode-extension:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install react-new dependencies since it contains the designer files
run: cd modules/workspaces/codegen/react-new && npm i --force
- name: Build
run: cd clients/fireback-tools-vs-code-extension && npm i --force && npm run package
- uses: actions/upload-artifact@master
with:
name: artifacts-vscode
path: artifacts
build-macos:
# if: ${{ inputs.release_artifacts == true }}
runs-on: macOS-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22
- name: Install sshpass
run: brew install hudochenkov/sshpass/sshpass
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install the dependencies
run: cd modules/workspaces/codegen/react-new && npm i --force
- name: Build Front-end
run: cd cmd/fireback && make ui2
- name: Download Packages installer build tool
run: wget http://s.sudre.free.fr/Software/files/Packages.dmg
- name: Mount Packages image
run: hdiutil attach Packages.dmg
- name: Install Packages
run: sudo installer -pkg /Volumes/Packages\ 1.2.10/Install\ Packages.pkg -target /
- name: Build Backend
run: cd cmd/fireback && make mac-pkg
- uses: actions/upload-artifact@master
with:
name: artifacts-darwin
path: artifacts