diff --git a/.github/actions/check/action.yml b/.github/actions/check/action.yml new file mode 100644 index 0000000000..7b7266426d --- /dev/null +++ b/.github/actions/check/action.yml @@ -0,0 +1,15 @@ +name: 'Check system' +description: 'checks system status' + +runs: + using: 'composite' + + steps: + - name: ⚙️ Check docker service + shell: bash + run: | + systemctl status docker + - name: ⚙️ Check docker info + shell: bash + run: | + docker info diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55ef1ce9d4..c11b85ab51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,11 @@ permissions: jobs: setup: runs-on: ubuntu-22.04 + timeout-minutes: 15 + + outputs: + uid: ${{ steps.init.outputs.uid }} + steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -31,6 +36,10 @@ jobs: with: save-cache: true + - name: ⚙️ Init + id: init + run: echo "uid=$(uuidgen)" >> ${GITHUB_OUTPUT} + lint: runs-on: ubuntu-22.04 needs: setup @@ -114,31 +123,60 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} - base: + build: runs-on: ubuntu-22.04 needs: setup timeout-minutes: 15 - outputs: - base: ${{ steps.init.outputs.base }} - steps: - - name: docker-config - uses: containerbase/internal-tools@4453842226e67bc5d507c41b21184cc9220f4974 # v3.5.19 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + show-progress: false + + - name: 📥 Setup Node.js + uses: ./.github/actions/setup-node + + - name: build + run: pnpm build + + - name: upload dist + uses: actions/upload-artifact@v4.6.0 with: - command: docker-config + name: dist + path: | + dist/ + + base: + runs-on: ${{ matrix.arch.os }} + name: base (${{ matrix.arch.name }}) + needs: + - setup + - build + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + arch: + - name: x86_64 + os: ubuntu-22.04 + tag: amd64 + - name: aarch64 + os: ubuntu-22.04-arm + tag: arm64 + + steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: show-progress: false - - name: init - id: init + - name: Check system + uses: ./.github/actions/check + + - name: ⚙️ Init run: | - export base="ttl.sh/$(uuidgen):1d" echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV} - echo "BASE=${base}" >> ${GITHUB_ENV} - echo "base=${base}" >> ${GITHUB_OUTPUT} + echo "BASE=ttl.sh/${{ needs.setup.outputs.uid }}/${{ matrix.arch.tag }}:1d" >> ${GITHUB_ENV} - name: 📥 Setup Node.js uses: ./.github/actions/setup-node @@ -146,8 +184,17 @@ jobs: - name: prepare apt proxy uses: ./.github/actions/prepare-proxy - - name: build - run: pnpm build + - name: fetch dist + uses: actions/download-artifact@v4.1.8 + with: + name: dist + path: dist + + - name: fix executable + run: | + chmod +x dist/cli/* + chmod +x dist/docker/usr/local/containerbase/bin/* + chmod +x dist/docker/usr/local/sbin/* - name: test distro run: docker buildx bake --set build-ttl.tags=${{env.BASE}} build-ttl @@ -161,6 +208,7 @@ jobs: - bats - lint - vitest + - build timeout-minutes: 30 strategy: @@ -175,15 +223,14 @@ jobs: TAG: ${{ matrix.distro }} steps: - - name: check docker - run: | - systemctl status docker - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: show-progress: false - - name: init + - name: Check system + uses: ./.github/actions/check + + - name: ⚙️ Init run: | echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV} @@ -193,8 +240,17 @@ jobs: - name: prepare apt proxy uses: ./.github/actions/prepare-proxy - - name: build - run: pnpm build + - name: fetch dist + uses: actions/download-artifact@v4.1.8 + with: + name: dist + path: dist + + - name: fix executable + run: | + chmod +x dist/cli/* + chmod +x dist/docker/usr/local/containerbase/bin/* + chmod +x dist/docker/usr/local/sbin/* - name: test distro run: docker buildx bake test-distro --set settings.secrets=type=env,id=GITHUB_TOKEN @@ -206,11 +262,12 @@ jobs: runs-on: ${{ matrix.arch.os }} name: ${{ matrix.tag }} (${{ matrix.arch.name }}) needs: + - setup - base - bats - lint - vitest - timeout-minutes: 30 + timeout-minutes: 15 strategy: max-parallel: 10 @@ -238,25 +295,26 @@ jobs: arch: - name: x86_64 os: ubuntu-22.04 + tag: amd64 - name: aarch64 os: ubuntu-22.04-arm + tag: arm64 env: TAG: ${{ matrix.tag }} steps: - - name: check docker - run: | - systemctl status docker - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: show-progress: false - - name: init + - name: Check system + uses: ./.github/actions/check + + - name: ⚙️ Init run: | echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV} - echo "BASE_IMAGE=${{ needs.base.outputs.base }}" >> ${GITHUB_ENV} + echo "BASE_IMAGE=ttl.sh/${{ needs.setup.outputs.uid }}/${{ matrix.arch.tag }}:1d" >> ${GITHUB_ENV} - name: 📥 Setup Node.js uses: ./.github/actions/setup-node diff --git a/docker-bake.hcl b/docker-bake.hcl index 79fa75e188..4b4fd61e32 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -92,10 +92,6 @@ target "build" { target "build-ttl" { inherits = ["settings"] output = ["type=registry"] - platforms = [ - "linux/amd64", - "linux/arm64", - ] tags = [ ] }