From 29c0b4a9a2b5cce4046d9a7f8cf80525cecca441 Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Thu, 21 Nov 2024 16:51:43 -0500 Subject: [PATCH] Switch to GitHub Actions --- .circleci/config.yml | 161 --------------------------------------- .github/workflows/ci.yml | 55 +++++++++++++ 2 files changed, 55 insertions(+), 161 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 0d00081..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,161 +0,0 @@ -exec: &exec - name: build-tools/nerves-system-br - version: 1.29.1 - elixir: 1.17.3-otp-27 - -version: 2.1 - -orbs: - build-tools: nerves-project/build-tools@0.3.0 - -jobs: - pre-build: - parameters: - exec: - type: executor - resource-class: - type: string - default: medium - executor: << parameters.exec >> - resource_class: << parameters.resource-class >> - steps: - - checkout - - build-tools/install-elixir: - version: $ELIXIR_VERSION - - build-tools/install-hex-rebar - - build-tools/install-nerves-bootstrap - - build-tools/mix-deps-get - - build-tools/restore-nerves-downloads - - run: - name: Create build dir - command: | - ./deps/nerves_system_br/create-build.sh nerves_defconfig build - - run: - name: make nerves-config - working_directory: build - command: make nerves-config - - run: - name: make linux - working_directory: build - command: make linux - - persist_to_workspace: - root: ~/project - paths: - - build - - deps - - build-system: - parameters: - exec: - type: executor - resource-class: - type: string - default: medium - hex-validate: - type: boolean - default: true - env-setup: - type: steps - default: [] - executor: << parameters.exec >> - resource_class: << parameters.resource-class >> - steps: - - checkout - - steps: << parameters.env-setup >> - - build-tools/install-elixir: - version: $ELIXIR_VERSION - - build-tools/install-hex-rebar - - build-tools/install-nerves-bootstrap - - build-tools/mix-deps-get - - build-tools/restore-nerves-downloads - - when: - condition: << parameters.hex-validate >> - steps: - - run: - name: Validate Hex package - command: mix hex.build - - attach_workspace: - at: ~/project - - run: - name: symlink build dir - command: | - mkdir -p .nerves/artifacts - ln -s $PWD/build $PWD/.nerves/artifacts/nerves_system_rpi5-portable-$(< VERSION) - - run: - name: Build - command: mix compile - - run: - name: Did I really build - command: | - [ -d .nerves ] || (echo "VERSION file needs to be bumped or a config file needs to change to force a build"; exit 1) - - run: - name: Lint - command: mix nerves.system.lint nerves_defconfig - - run: - name: Create artifact dir - command: mkdir -p deploy/system/artifacts - - run: - name: Copy CHANGELOG - command: cp ./CHANGELOG.md deploy/system/CHANGELOG.md - - - run: - name: Create artifacts - command: | - if [ -n "$CIRCLE_TAG" ]; then - TAG=$CIRCLE_TAG - else - TAG=$CIRCLE_SHA1 - fi - mix nerves.artifact ${CIRCLE_PROJECT_REPONAME} --path deploy/system/artifacts - - store_artifacts: - path: deploy/system/artifacts - destination: system - - save_cache: - key: deploy/system-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }} - paths: - - "deploy/system" - -workflows: - build_test_deploy: - jobs: - - build-tools/get-br-dependencies: - exec: - <<: *exec - context: org-global - filters: - tags: - only: /.*/ - - pre-build: - exec: - <<: *exec - resource-class: large - context: org-global - requires: - - build-tools/get-br-dependencies - filters: - tags: - only: /.*/ - # - build-tools/build-system: - - build-system: - exec: - <<: *exec - resource-class: large - context: org-global - requires: - - build-tools/get-br-dependencies - - pre-build - filters: - tags: - only: /.*/ - - build-tools/deploy-system: - exec: - <<: *exec - context: org-global - requires: - # - build-tools/build-system - - build-system - filters: - branches: - ignore: /.*/ - tags: - only: /v.*/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9edd727 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: [push] + +env: + OTP_VERSION: 27.1.2 + ELIXIR_VERSION: 1.17.3-otp-27 + NERVES_BOOTSTRAP_VERSION: 1.13.0 + +permissions: + id-token: write + contents: read + +jobs: + get-br-dependencies: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: gridpoint-com/actions-nerves-system@v1 + - name: Get Buildroot Dependencies + uses: ./.actions/get-br-dependencies + with: + otp-version: ${{ env.OTP_VERSION }} + elixir-version: ${{ env.ELIXIR_VERSION }} + nerves-bootstrap-version: ${{ env.NERVES_BOOTSTRAP_VERSION }} + push-to-download-site: false + download-site-url: ${{ vars.PUBLIC_S3_SITE }} + download-site-bucket-uri: ${{ vars.S3_BUCKET }} + aws-role: ${{ secrets.AWS_ROLE }} + aws-region: ${{ vars.AWS_REGION }} + build-system: + needs: [get-br-dependencies] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: gridpoint-com/actions-nerves-system@v1 + - name: Build nerves_system + uses: ./.actions/build-system + with: + otp-version: ${{ env.OTP_VERSION }} + elixir-version: ${{ env.ELIXIR_VERSION }} + nerves-bootstrap-version: ${{ env.NERVES_BOOTSTRAP_VERSION }} + deploy-system: + needs: [build-system] + if: github.ref_type == 'tag' + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: gridpoint-com/actions-nerves-system@v1 + - name: Deploy nerves_system + uses: ./.actions/deploy-system + with: + github-token: ${{ secrets.GITHUB_TOKEN }}