From 90d221498aa618b863b3b59a60560b69e6b5eff3 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Mon, 20 May 2024 20:39:25 +1000 Subject: [PATCH] Weave into full pipeline --- .github/workflows/build-and-release.yml | 80 ++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 930e240..23fb1a3 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -9,8 +9,36 @@ on: - '**' jobs: - system-test: + test: runs-on: ubuntu-latest + strategy: + matrix: + include: + - architecture: amd64 + artifact: ebs-bootstrap-linux-x86_64 + - architecture: arm64 + artifact: ebs-bootstrap-linux-aarch64 + name: Build and Test (${{ matrix.architecture }}) ๐Ÿ”จ + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.architecture }} + - name: Build and Test ๐Ÿ”จ + run: ./build/docker.sh --architecture ${{ matrix.architecture }} + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact }} + path: ${{ matrix.artifact }} + if-no-files-found: error + retention-days: 1 + + integration-tests: + runs-on: ubuntu-latest + name: Integration Tests ๐Ÿงช + needs: + - test steps: - name: Checkout code ๐Ÿ›’ uses: actions/checkout@v4 @@ -20,15 +48,15 @@ jobs: with: bats-version: 1.11.0 - # - name: Download all workflow run artifacts - # uses: actions/download-artifact@v3 + - name: Download binaries ๐Ÿ“ฅ + uses: actions/download-artifact@v4 - - name: Download ๐Ÿ“ฅ + - name: Make executable shell: bash run: | - curl -fLsS https://github.com/reecetech/ebs-bootstrap/releases/download/v1.0.7/ebs-bootstrap-linux-x86_64 \ - -o ebs-bootstrap - + set -euo pipefail + mv ebs-bootstrap ebs-bootstrap-download + mv ebs-bootstrap-download/ebs-bootstrap-linux-x86_64 ebs-bootstrap chmod +x ebs-bootstrap - name: Setup tests โš™๏ธ @@ -39,3 +67,41 @@ jobs: - name: Test xfs ๐Ÿงซ run: bats bats/xfs.bats + + release: + if: ${{ github.ref_name == github.event.repository.default_branch }} # Only release from the default branch + runs-on: ubuntu-latest + name: Release ๐Ÿš€ + needs: + - integration-tests + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@v4 + - name: Download all workflow run artifacts + uses: actions/download-artifact@v4 + - id: version + name: Get next version + uses: reecetech/version-increment@2023.10.2 + with: + scheme: semver + increment: patch + - id: github-release + name: Create Github Release ๐Ÿ“ฆ + uses: softprops/action-gh-release@v0.1.15 + with: + tag_name: ${{ steps.version.outputs.v-version }} + prerelease: false + draft: false + token: ${{ secrets.GITHUB_TOKEN }} + generate_release_notes: true + files: | + */ebs-bootstrap-linux-* + - id: push-short-tag + name: Create release short tag ๐Ÿท + uses: richardsimko/update-tag@v1.0.11 + with: + tag_name: ${{ steps.version.outputs.major-v-version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}