diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..90416516 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,104 @@ +name: Reusable build workflow + +on: + workflow_call: + secrets: + SSH_KEY: + required: true + KNOWN_HOSTS: + required: true + TS_OAUTH_SECRET: + required: true + TS_OAUTH_CLIENT_ID: + required: true + +jobs: + build: + strategy: + matrix: + include: + - NodeVersion: 14 + OS: linux-latest + - NodeVersion: 18 + OS: linux-latest + - NodeVersion: 16 + OS: windows-latest + - NodeVersion: 18 + OS: windows-latest + - NodeVersion: 16 + OS: macos-latest + - NodeVersion: 18 + OS: macos-latest + name: Node.js v${{ matrix.NodeVersion }} (${{ matrix.OS }}) + runs-on: ${{ matrix.OS }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.NodeVersion }} + + - name: Connect to Tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} + oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} + tags: tag:tinyburg-ci + + - name: Testing Server Online? + run: | + tailscale status + tailscale ping ci.internal.tinyburg.app + + - name: Start ssh agent + run: | + eval "$(ssh-agent -s)" + echo $SSH_AUTH_SOCK + echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + + - name: Add SSH key to agent + run: | + echo $SSH_AUTH_SOCK + ssh-add -D + ssh-add + + - name: Testing Server Reachable? + run: ssh ci@ci.internal.tinyburg.app "echo 'Hi, Mom!'" + + - if: runner.os == 'Linux' + name: Start xvfb + run: | + sudo /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + echo "DISPLAY=:99" >> $GITHUB_ENV + + - name: Setup cache + uses: actions/cache@v3 + with: + path: common/temp/build-cache + key: ${{ runner.os }}_node-${{ matrix.NodeVersion }}_build-cache + + - name: Verify Change Logs + run: node common/scripts/install-run-rush.js change --verify + + - name: Rush Install + run: | + node common/scripts/install-run-rush.js install + node common/scripts/install-run-rush.js update-autoinstaller --name rush-prettier + node common/scripts/install-run-rush.js update-autoinstaller --name rush-commitlint + + - name: Rush build and test + run: | + node common/scripts/install-run-rush.js rebuild + node common/scripts/install-run-rush.js test --timeline --production + env: + RUSH_BUILD_CACHE_ENABLED: 1 + RUSH_BUILD_CACHE_WRITE_ALLOWED: 1 + ARCHITECT_DOCKER_HOST: "ssh://ci@ci.internal.tinyburg.app:22" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ec865ee..96c91599 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,78 +8,21 @@ on: workflow_dispatch: jobs: - build: - name: Node.js v${{ matrix.NodeVersion }} - runs-on: ubuntu-latest - strategy: - matrix: - NodeVersion: [16, 18] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.NodeVersion }} - - - name: Connect to Tailscale - uses: tailscale/github-action@v2 - with: - oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} - oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} - tags: tag:ci - - - name: Testing Server Online? - run: | - tailscale status - tailscale ping ci.internal.tinyburg.app - - - name: Start ssh agent - run: | - eval "$(ssh-agent -s)" - echo $SSH_AUTH_SOCK - echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV - - - name: Install SSH key - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_KEY }} - known_hosts: ${{ secrets.KNOWN_HOSTS }} + call-workflow: + uses: ./.github/workflows/build.yaml - - name: Add SSH key to agent - run: | - echo $SSH_AUTH_SOCK - ssh-add -D - ssh-add - - - name: Testing Server Reachable? - run: ssh ci@ci.internal.tinyburg.app "echo 'Hi, Mom!'" - - - name: Verify Change Logs - run: node common/scripts/install-run-rush.js change --verify + deploy-authproxy: + needs: build + runs-on: ubuntu-latest - - name: Setup cache - uses: actions/cache@v3 - with: - path: | - common/temp/build-cache - packages/apks/downloads/apkmirror - packages/apks/downloads/apkpure - key: ${{ runner.os }}_node-${{ matrix.NodeVersion }}_build-cache + deploy-auto-gold-bits: + needs: build + runs-on: ubuntu-latest - - name: Rush Install - run: | - node common/scripts/install-run-rush.js install - node common/scripts/install-run-rush.js update-autoinstaller --name rush-prettier - node common/scripts/install-run-rush.js update-autoinstaller --name rush-commitlint + deploy-discord-bot: + needs: build + runs-on: ubuntu-latest - - name: Rush build and test - run: | - export DISPLAY=:99 - sudo /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - node common/scripts/install-run-rush.js test --timeline --production - env: - RUSH_BUILD_CACHE_ENABLED: 1 - RUSH_BUILD_CACHE_WRITE_ALLOWED: 1 - ARCHITECT_DOCKER_HOST: "ssh://ci@ci.internal.tinyburg.app:22" + deploy-repl-demo: + needs: build + runs-on: ubuntu-latest