mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-20 17:52:51 +00:00
Merge pull request #2010 from balena-os/flowzone
Switch from balenaCI to flowzone
This commit is contained in:
commit
13195050fd
25
.github/workflows/balena-ci.yml
vendored
25
.github/workflows/balena-ci.yml
vendored
@ -1,25 +0,0 @@
|
||||
name: balenaCloud
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, closed]
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy-release:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
arch: [aarch64, amd64, armv7hf, i386, rpi]
|
||||
environment: [ { tld: balena-cloud.com, token_prop_name: BALENA_TOKEN }, { tld: balena-staging.com, token_prop_name: BALENA_STAGING_TOKEN } ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: balena-io/balena-ci@master
|
||||
name: 'Deploy to ${{ matrix.environment.tld }}'
|
||||
with:
|
||||
balena_token: ${{ secrets[matrix.environment.token_prop_name] }}
|
||||
fleet: 'balena_os/${{ matrix.arch }}-supervisor'
|
||||
versionbot: true
|
||||
environment: ${{ matrix.environment.tld }}
|
45
.github/workflows/flowzone.yml
vendored
Normal file
45
.github/workflows/flowzone.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
name: Flowzone
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, closed]
|
||||
branches:
|
||||
- "main"
|
||||
- "master"
|
||||
|
||||
jobs:
|
||||
flowzone-staging:
|
||||
name: balena-staging
|
||||
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
|
||||
secrets:
|
||||
FLOWZONE_TOKEN: ${{ secrets.FLOWZONE_TOKEN }}
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||
BALENA_API_KEY: ${{ secrets.BALENA_STAGING_TOKEN }}
|
||||
with:
|
||||
balena_environment: balena-staging.com
|
||||
balena_slugs: |
|
||||
balena_os/aarch64-supervisor,
|
||||
balena_os/amd64-supervisor,
|
||||
balena_os/armv7hf-supervisor,
|
||||
balena_os/i386-supervisor,
|
||||
balena_os/rpi-supervisor
|
||||
job_name: balena-staging
|
||||
|
||||
flowzone:
|
||||
name: balena-cloud
|
||||
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
|
||||
secrets:
|
||||
FLOWZONE_TOKEN: ${{ secrets.FLOWZONE_TOKEN }}
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||
BALENA_API_KEY: ${{ secrets.BALENA_TOKEN }}
|
||||
with:
|
||||
balena_environment: balena-cloud.com
|
||||
balena_slugs: |
|
||||
balena_os/aarch64-supervisor,
|
||||
balena_os/amd64-supervisor,
|
||||
balena_os/armv7hf-supervisor,
|
||||
balena_os/i386-supervisor,
|
||||
balena_os/rpi-supervisor
|
||||
job_name: balena-cloud
|
10
.resinci.yml
10
.resinci.yml
@ -1,9 +1 @@
|
||||
reviewers: 1
|
||||
docker:
|
||||
publish: false
|
||||
builds:
|
||||
- dockerfile: Dockerfile.null
|
||||
docker_repo: dev-null
|
||||
path: .
|
||||
publish: false
|
||||
npm: false
|
||||
disabled: true
|
||||
|
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
# IMPORTANT: Do **not** use this Dockerfile.
|
||||
# This Dockerfile only exists to allow flowzone to run docker-compose.test.yml
|
||||
# but without the CI needing to do extra work building a throwaway image.
|
||||
# The real build happens in the balena builder so for testing we just want
|
||||
# to build up to the test stage.
|
||||
FROM alpine
|
@ -1,5 +0,0 @@
|
||||
# This dockerfile is used to trick resinCI to pick up
|
||||
# docker-compose.test.yml but without the CI needing to do extra
|
||||
# work building a throwaway image. The real build happens in the balena builder
|
||||
# so for testing we just want to build up to the test stage
|
||||
FROM alpine
|
@ -106,7 +106,7 @@ COPY test ./test
|
||||
# most likely fail.
|
||||
# For now this also runs the legacy tests, that are slow, this is a
|
||||
# forcing function to finish the split between unit/integration
|
||||
RUN npm run test:base
|
||||
RUN npm run test
|
||||
|
||||
# When running tests from a container built from this stage,
|
||||
# skip the mocha-pod setup
|
||||
@ -135,7 +135,12 @@ RUN npm run build
|
||||
|
||||
# Run the production install here, to avoid the npm dependency on
|
||||
# the later stage
|
||||
RUN npm ci --production --no-optional --unsafe-perm --build-from-source --sqlite=/usr/lib \
|
||||
RUN npm ci \
|
||||
--production \
|
||||
--no-optional \
|
||||
--unsafe-perm \
|
||||
--build-from-source \
|
||||
--sqlite=/usr/lib \
|
||||
&& npm cache clean --force \
|
||||
# For some reason this doesn't get cleared with the other
|
||||
# cache
|
||||
|
@ -182,7 +182,7 @@ integration tests require a containerized environment with the right dependencie
|
||||
To run type checks, and unit tests, you can use:
|
||||
|
||||
```
|
||||
npm run test:base
|
||||
npm run test
|
||||
```
|
||||
|
||||
The supervisor runs on Node v12.16.2, so using that specific
|
||||
@ -190,7 +190,7 @@ version will ensure tests run in the same environment as
|
||||
production.
|
||||
|
||||
In order to run all tests, unit and integration, [docker-compose](https://docs.docker.com/compose/) is required.
|
||||
The following command will build the image for an `amd64` target (running `test:base` during the build) and setup
|
||||
The following command will build the image for an `amd64` target (running `test` during the build) and setup
|
||||
the necessary dependencies for running integration tests.
|
||||
|
||||
```
|
||||
@ -216,7 +216,7 @@ docker exec -ti $(docker ps -q --filter="name=_sut") sh
|
||||
And then run all tests using
|
||||
|
||||
```
|
||||
npm run test
|
||||
npm run test:node
|
||||
```
|
||||
|
||||
For more information about testing the Supervisor, see the [testing README](test/README.md).
|
||||
@ -254,6 +254,8 @@ When developing on macOS you may need to install DBus on the development host.
|
||||
1. `brew install dbus`
|
||||
2. `npm ci`
|
||||
|
||||
On Debian-based systems, `sudo apt install libdbus-1-dev` would be the equivalent.
|
||||
|
||||
#### Downgrading versions
|
||||
|
||||
The Supervisor will always be forwards compatible so you can just simply run newer versions. If there is data that must be normalized to a new schema such as the naming of engine resources, values in the sqlite database, etc then the new version will automatically take care of that either via [migrations](/src/migrations) or at runtime when the value is queried.
|
||||
|
22
build-utils/install-dbus.sh
Executable file
22
build-utils/install-dbus.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
DEBIAN=libdbus-1-dev
|
||||
OSX=dbus
|
||||
|
||||
if command -v apt > /dev/null; then
|
||||
if dpkg --list | grep $DEBIAN > /dev/null; then
|
||||
exit 0
|
||||
else
|
||||
echo "Installing $DEBIAN..."
|
||||
sudo apt-get install $DEBIAN
|
||||
fi
|
||||
elif command -v brew > /dev/null; then
|
||||
brew list $OSX > /dev/null || (echo "Installing $OSX..." && brew install $OSX)
|
||||
else
|
||||
echo "Neither 'brew' nor 'apt' are available to this system.
|
||||
Please make sure Supervisor development is done on Linux, OSX, or WSL2,
|
||||
and that one of the above package managers is installed. If using a
|
||||
Linux distro without 'apt', please install the dbus development lib
|
||||
available to your system and run 'npm ci --ignore-scripts' to continue."
|
||||
exit 0
|
||||
fi
|
@ -5,7 +5,7 @@ services:
|
||||
# be run through the `sut` service
|
||||
balena-supervisor:
|
||||
build:
|
||||
dockerfile: Dockerfile.null
|
||||
dockerfile: Dockerfile
|
||||
context: ./
|
||||
command: sleep infinity
|
||||
|
||||
|
@ -18,13 +18,13 @@
|
||||
"test:node": "npm run test:unit && npm run test:integration && npm run test:legacy",
|
||||
"test:env": "docker-compose -f docker-compose.test.yml -f docker-compose.dev.yml up --build; npm run compose:down",
|
||||
"test:compose": "docker-compose -f docker-compose.yml -f docker-compose.test.yml up --build --remove-orphans --exit-code-from=sut ; npm run compose:down",
|
||||
"test:base": "npm run lint && npm run test:build && npm run test:unit && npm run test:legacy",
|
||||
"test": "npm run lint && npm run test:build && npm run test:node",
|
||||
"test": "npm run lint && npm run test:build && npm run test:unit && npm run test:legacy",
|
||||
"compose:down": "docker-compose -f docker-compose.test.yml down",
|
||||
"prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js",
|
||||
"release": "tsc --project tsconfig.release.json && mv build/src/* build",
|
||||
"sync": "ts-node --files sync/sync.ts",
|
||||
"clean": "rimraf build"
|
||||
"clean": "rimraf build",
|
||||
"preinstall": "./build-utils/install-dbus.sh || true"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user