From 57cd9337ef3e063efdd99f590dca77dad22b9e63 Mon Sep 17 00:00:00 2001 From: Garrett Summerfield Date: Fri, 27 Sep 2024 20:10:05 -0500 Subject: [PATCH] Add Dependabot, GitHub Actions workflows Added GitHub Actions workflows for building and releasing node-can-bridge. This can run specific tasks automatically to ensure builds are operational. This also includes making releases via pushing tags. Added Dependabot to update workflow Actions to ensure they are up to date to negate any security issues and deprecation issues with older Actions. --- .github/dependabot.yml | 7 +++ .github/workflows/build.yml | 84 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 52 ++++++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0f83d09 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Dependabot updates for GitHub Actions + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: "weekly" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a71df48 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,84 @@ +name: Build + +on: + [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: false + +defaults: + run: + shell: bash + +jobs: + build-docker: + strategy: + fail-fast: false + matrix: + include: + - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 + name: LinuxARM64 + platform-type: linuxarm64 + arch: arm64 + - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 + name: LinuxARM32 + platform-type: linuxarm32 + arch: arm32 + runs-on: ubuntu-latest + name: "Build - ${{ matrix.name }}" + container: ${{ matrix.container }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: npm install + + - name: Pretest + run: npm run pretest + + # Due to the nature of the build process, we can't run the tests in the container becauase external hardware is required + # If this were to be running on a local machine, the tests would be run here + #- name: Test + # run: npm test + + build-native: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + name: "Build - ${{ matrix.os }}" + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: npm install + + - name: Pretest + run: npm run pretest + + # Due to the nature of the build process, we can't run the tests in the container becauase external hardware is required + # If this were to be running on a local machine, the tests would be run here + #- name: Test + # run: npm test \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..40a0c7e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Create release + +on: + push: + tags: + - 'v*' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: false + +defaults: + run: + shell: bash + +jobs: + release: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + name: "Release - ${{ matrix.os }}" + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + files: dist/* + tag_name: ${{ github.ref }} + name: ${{ github.ref }} + body: | + This is a release for version ${{ github.ref }}. + It contains the compiled files from the build process. \ No newline at end of file