Skip to content

Commit

Permalink
Separate migration from agama repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jcronenberg committed Nov 7, 2024
1 parent 3b13202 commit d5bdae6
Show file tree
Hide file tree
Showing 8 changed files with 873 additions and 572 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/configure_osc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/bash

# This helper script creates the "osc" configuration file with OBS credentials

CONFIG_FILE="$HOME/.config/osc/oscrc"

# do not overwrite the existing config accidentally
if [ -e "$CONFIG_FILE" ]; then
echo "ERROR: $CONFIG_FILE already exists"
exit 1
fi

TEMPLATE=$(dirname "${BASH_SOURCE[0]}")/oscrc.template
mkdir -p $(dirname "$CONFIG_FILE")
sed -e "s/@OBS_USER@/$OBS_USER/g" -e "s/@OBS_PASSWORD@/$OBS_PASSWORD/g" "$TEMPLATE" > "$CONFIG_FILE"
48 changes: 48 additions & 0 deletions .github/workflows/migrate-wicked-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "migrate-wicked CI"

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
rust_ci:
runs-on: ubuntu-latest

strategy:
fail-fast: false

steps:
- name: Git Checkout
uses: actions/checkout@v3

- name: Install toolchain
run: rustup toolchain install stable

- name: Install dependencies
run: sudo apt install libclang-dev libpam-dev

- name: Install cargo-binstall
uses: taiki-e/install-action@v2
with:
tool: cargo-binstall

- name: Install tarpaulin
run: cargo-binstall --no-confirm cargo-tarpaulin

- name: Unit tests
run: cargo tarpaulin --color always --out xml

- name: Lint tests
run: cargo fmt --all -- --check

- name: Cargo clippy
run: cargo clippy -- --no-deps -D warnings

- name: Cargo clippy on unit tests
run: cargo clippy -- --no-deps --cfg test -A unused_imports -D warnings

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
with:
format: cobertura
26 changes: 26 additions & 0 deletions .github/workflows/migrate-wicked-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "migrate-wicked CI - Integration Tests"

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
integration-tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false

steps:
- name: Git Checkout
uses: actions/checkout@v3

- name: Start container
run: podman run --detach --name migrate-wicked -e CARGO_TERM_COLOR=always -v .:/checkout registry.opensuse.org/home/jcronenberg/github-ci/containers/opensuse/migrate-wicked-testing:latest

- name: Build migrate-wicked
run: podman exec migrate-wicked bash -c "cd /checkout/ && cargo build"

- name: Run migration integration tests
run: podman exec migrate-wicked bash -c "/checkout/tests/test.sh"
61 changes: 61 additions & 0 deletions .github/workflows/obs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Update OBS Git Package

on:
push:
branches:
- wicked-nm-migration
paths:
- rust/migrate-wicked/**

jobs:
update_obs_package:
# do not run in forks
if: github.repository == 'jcronenberg/agama'

runs-on: ubuntu-latest

container:
image: registry.opensuse.org/opensuse/tumbleweed:latest

steps:
- name: Git Checkout
uses: actions/checkout@v3

- name: Configure and refresh repositories
# disable unused repositories to have a faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref

- name: Install tools
run: zypper --non-interactive install --no-recommends
git
obs-service-obs_scm
obs-service-cargo_vendor
obs-service-set_version
obs-service-tar
osc
cpio

- name: Configure osc
run: .github/workflows/configure_osc.sh
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASSWORD: ${{ secrets.OBS_PW }}

- name: Checkout package
run: osc checkout home:jcronenberg:migrate-wicked/migrate-wicked-git -o migrate-wicked-git-package

- name: Remove current obscpio
run: rm -f *.obscpio
working-directory: ./migrate-wicked-git-package

- name: Run osc service manualrun
run: osc service manualrun
working-directory: ./migrate-wicked-git-package

- name: Update current files in osc
run: osc ar
working-directory: ./migrate-wicked-git-package

- name: Commit to OBS
run: osc commit -m "$GITHUB_SHA"
working-directory: ./migrate-wicked-git-package
7 changes: 7 additions & 0 deletions .github/workflows/oscrc.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[general]
apiurl = https://api.opensuse.org

[https://api.opensuse.org]
user=@OBS_USER@
pass=@OBS_PASSWORD@
credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager
Loading

0 comments on commit d5bdae6

Please sign in to comment.