Skip to content

fix(networking): update CIDR range hint for subnet creation form #1897

fix(networking): update CIDR range hint for subnet creation form

fix(networking): update CIDR range hint for subnet creation form #1897

Workflow file for this run

# run local with act
# Note: the dummy.env file is not optional to prevent act to load the .env file
# this is super important because if a proxy is set in the .env file,
# because act will use the proxy and the tests will fail
# act -j test --env-file dummy.env --rm
name: Checks
on:
pull_request:
types:
- labeled
- opened
- synchronize
- reopened
permissions:
contents: read
jobs:
# Check permissions and prerequisites
check-permissions:
name: Check PR permissions
runs-on: ubuntu-latest
steps:
- name: Check for fork and missing label
if: |
github.event.pull_request.head.repo.full_name != github.repository && !contains(github.event.pull_request.labels.*.name, 'save-to-merge')
run: |
echo "PR is from a fork and the label 'save-to-merge' is missing, this will not pass 🧙❌"
echo "Message for the Maintainer: Please check the tests and if they are ok, add the label 'save-to-merge' to the PR."
exit 1
# Ruby/Rails tests
test-rails:
name: Rails tests
runs-on: ubuntu-latest
needs: check-permissions
container:
image: ruby:3.2
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "postgres"
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Gem cache
id: cache-bundle
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: vendor/bundle
key: bundle-${{ hashFiles('**/Gemfile.lock') }}
- name: Bundle install
env:
RAILS_ENV: test
run: |
gem install bundler -v 2.6.9
bundle install --jobs 4 --retry 3 --path vendor/bundle
- name: Setup DB and run Rails tests
env:
POSTGRES_SERVICE_HOST: postgres
PGUSER: postgres
PGPORT: 5432
RAILS_ENV: test
run: |
bin/rake db:create db:migrate
bundle exec rspec
# JavaScript/TypeScript tests
test-javascript:
name: JavaScript tests
runs-on: ubuntu-latest
needs: check-permissions
# Only run for PRs from the same repo (has access to secrets)
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Setup Javascript (act only)
if: ${{ env.ACT }}
run: |
apt-get update
apt-get install -y nodejs
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "20.x"
registry-url: "https://npm.pkg.github.com"
scope: "@sapcc"
env:
NODE_AUTH_TOKEN: ${{ secrets.ELEKTRA_GITHUB_NPM_TOKEN }}
- name: Install pnpm
run: npm install -g pnpm
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run JavaScript tests
run: pnpm test
# TypeScript type checking
typecheck:
name: TypeScript check
runs-on: ubuntu-latest
needs: check-permissions
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Setup Javascript (act only)
if: ${{ env.ACT }}
run: |
apt-get update
apt-get install -y nodejs
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "20.x"
registry-url: "https://npm.pkg.github.com"
scope: "@sapcc"
env:
NODE_AUTH_TOKEN: ${{ secrets.ELEKTRA_GITHUB_NPM_TOKEN }}
- name: Install pnpm
run: npm install -g pnpm
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run TypeScript check
run: pnpm typecheck
# ESLint checking
lint:
name: Lint check
runs-on: ubuntu-latest
needs: check-permissions
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Setup Javascript (act only)
if: ${{ env.ACT }}
run: |
apt-get update
apt-get install -y nodejs
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "20.x"
registry-url: "https://npm.pkg.github.com"
scope: "@sapcc"
env:
NODE_AUTH_TOKEN: ${{ secrets.ELEKTRA_GITHUB_NPM_TOKEN }}
- name: Install pnpm
run: npm install -g pnpm
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run lint check
run: pnpm lint