diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69c9a96..6c92033 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,6 @@ name: ci - 'LICENSE' - 'README.md' -defaults: - run: - working-directory: 'bcook254.vaultwarden' - jobs: lint: @@ -23,13 +19,6 @@ jobs: steps: - name: Check out the codebase. uses: actions/checkout@v4 - with: - path: 'bcook254.vaultwarden' - - - name: Set up Python 3. - uses: actions/setup-python@v5 - with: - python-version: '3.x' - name: Install test dependencies. run: python -m pip install yamllint @@ -38,7 +27,7 @@ jobs: run: yamllint . molecule: - name: Molecule Test + name: Molecule Test (${{ matrix.platform.name }}) runs-on: ubuntu-latest strategy: fail-fast: false @@ -61,19 +50,12 @@ jobs: steps: - name: Check out the codebase. uses: actions/checkout@v4 - with: - path: 'bcook254.vaultwarden' - - - name: Set up Python 3. - uses: actions/setup-python@v5 - with: - python-version: '3.x' - name: Install test dependencies. - run: python -m pip install ansible molecule molecule-plugins[docker] docker + run: python -m pip install molecule molecule-plugins[docker] - name: Run Molecule tests. - run: molecule test --driver-name docker --scenario-name ci + run: molecule test --driver-name docker env: PLATFORM_NAME: ${{ matrix.platform.name }} PLATFORM_IMAGE: ${{ matrix.platform.image }} @@ -81,3 +63,17 @@ jobs: VAULTWARDEN_URL: ${{ secrets.VAULTWARDEN_URL }} PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' + + check: + name: Molecule Tests + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + needs: [molecule] + steps: + - name: Exit on failure + if: ${{ needs.molecule.result == 'failure' }} + shell: bash + run: exit 1 + - name: Exit + shell: bash + run: exit 0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68c3a24..4a4dcb0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,29 +4,12 @@ name: Release tags: - '*' -defaults: - run: - working-directory: 'bcook254.vaultwarden' - jobs: release: name: Release runs-on: ubuntu-latest steps: - - name: Check out the codebase. - uses: actions/checkout@v3 - with: - path: 'bcook254.vaultwarden' - - - name: Set up Python 3. - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install Ansible. - run: python3 -m pip install ansible-core - - name: Trigger a new import on Galaxy. run: >- ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} diff --git a/molecule/ci/converge.yml b/molecule/ci/converge.yml deleted file mode 100644 index 5f5dae9..0000000 --- a/molecule/ci/converge.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: Converge - hosts: all - - vars: - vaultwarden_file: "{{ None if (vaultwarden_url is defined and vaultwarden_url | length > 0) else 'molecule/vaultwarden' }}" - vaultwarden_manage_config: true - - roles: - - role: bcook254.vaultwarden diff --git a/molecule/ci/molecule.yml b/molecule/ci/molecule.yml deleted file mode 100644 index a264d0b..0000000 --- a/molecule/ci/molecule.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -dependency: - name: galaxy - options: - requirements-file: requirements.yml -driver: - name: podman -platforms: - - name: ${PLATFORM_NAME} - image: ${PLATFORM_IMAGE} - command: ${MOLECULE_DOCKER_COMMAND:-""} - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:rw - cgroupns_mode: host - privileged: true - pre_build_image: true -provisioner: - inventory: - group_vars: - all: - vaultwarden_version: "${VAULTWARDEN_VERSION}" - vaultwarden_url: "${VAULTWARDEN_URL}" - vaultwarden_url_checksum: "sha256:{{ vaultwarden_url }}.sha256" - host_vars: - centosstream9: - vaultwarden_packages: - - openssl - - ca-certificates - - curl-minimal - - mariadb-devel - - libpq - name: ansible - config_options: - defaults: - interpreter_python: auto_silent - callbacks_enabled: yaml - ssh_connection: - pipelining: false -verifier: - name: ansible -lint: | - set -e - ansible-lint . \ No newline at end of file diff --git a/molecule/ci/prepare.yml b/molecule/ci/prepare.yml deleted file mode 100644 index 834cc9f..0000000 --- a/molecule/ci/prepare.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: Prepare - hosts: all - - roles: - - name: 0x0I.systemd - vars: - unit_config: - - name: vaultwarden - enabled: yes - state: started - Unit: - Description: Vaultwarden - An unofficial Bitwarden compatible server - After: network.target - Service: - Type: simple - Restart: on-failure - RestartSec: 2s - TimeoutStopSec: 0 - User: vaultwarden - Group: vaultwarden - EnvironmentFile: "/etc/vaultwarden/vaultwarden.env" - WorkingDirectory: "/var/lib/vaultwarden" - ExecStart: "/usr/local/bin/vaultwarden" - Install: - WantedBy: multi-user.target diff --git a/molecule/ci/requirements.yml b/molecule/ci/requirements.yml deleted file mode 100644 index ae67a8e..0000000 --- a/molecule/ci/requirements.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- src: 0x0I.systemd diff --git a/molecule/ci/verify.yml b/molecule/ci/verify.yml deleted file mode 100644 index 0b81a21..0000000 --- a/molecule/ci/verify.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: Verify - hosts: all - gather_facts: false - - tasks: - - name: Check if Vaultwarden is installed. - ansible.builtin.stat: - path: /usr/local/bin/vaultwarden - - - name: Verify correct version of Vaultwarden has been installed. - ansible.builtin.command: vaultwarden --version - args: - chdir: /usr/local/bin - changed_when: false - register: __vaultwarden_version - failed_when: __vaultwarden_version is not search(vaultwarden_version if vaultwarden_version | length > 0 else '1.30.5') - - - name: Check if Vaultwarden web-vault is installed. - ansible.builtin.stat: - path: /var/lib/vaultwarden/web-vault - - - name: Check if vaultwarden.service is started - ansible.builtin.service: - name: vaultwarden - state: started - enabled: true - check_mode: true - register: service - failed_when: (service is changed) or (service is failed) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 7c47ec1..e60e6a3 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -6,11 +6,11 @@ dependency: driver: name: podman platforms: - - name: ${MOLECULE_DISTRO:-ubuntu2404} - image: docker.io/geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2404}-ansible:latest + - name: ${PLATFORM_NAME:-ubuntu2404} + image: ${PLATFORM_IMAGE:-"docker.io/geerlingguy/docker-ubuntu2404-ansible:latest"} command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true cgroupns_mode: host pre_build_image: true @@ -40,5 +40,4 @@ verifier: name: ansible lint: | set -e - yamllint . ansible-lint .