ci: add tests
Some checks failed
development / Check commit compliance (push) Successful in 5s
pull-requests-open / Check commit compliance (pull_request) Successful in 5s
pull-requests-open / Check pre-commit status (pull_request) Successful in 13s
pull-requests-open / Run E2E tofu tests (pull_request) Failing after 17s

This commit is contained in:
Bertrand Lanson 2024-09-09 20:51:06 +02:00
parent 4d9f46876e
commit 331752707d
Signed by: lanson
SSH Key Fingerprint: SHA256:/nqc6HGqld/PS208F6FUOvZlUzTS0rGpNNwR5O2bQBw
3 changed files with 44 additions and 8 deletions

View File

@ -16,11 +16,11 @@ jobs:
- name: Install commitizen
run: pip3 install commitizen
shell: bash
working-directory: ./
working-directory: ${{ gitea.workspace }}
- name: Verify commit message compliance
run: |
echo "cz check --message '${{ github.event.head_commit.message }}'"
cz check --message "${{ github.event.head_commit.message }}"
shell: bash
working-directory: ./
working-directory: ${{ gitea.workspace }}

View File

@ -41,9 +41,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Install pre-commit
run: pip3 install pre-commit
@ -76,3 +73,42 @@ jobs:
run: pre-commit run --all
shell: bash
working-directory: ${{ gitea.workspace }}
end-to-end-tests:
name: Run E2E tofu tests
runs-on: ubuntu-latest
needs: pre-commit-check
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install required packages
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt update
sudo apt install -y curl jq
curl https://vault.ednz.fr/v1/ednz-root-ca/ca -o /tmp/ednz_ca
openssl x509 -inform DER -in /tmp/ednz_ca -out /usr/local/share/ca-certificates/ednz_ca.crt -outform pem
update-ca-certificates
- name: Install OpenTofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.8.2
- name: Get required credentials
id: tofu-auth
run: |
VAULT_TOKEN=$(curl --silent --request POST --data '{"role_id": "${{ steps.import-secrets.outputs.VAULT_INFRABUILDER_APPROLE_ID }}","secret_id": "${{ steps.import-secrets.outputs.VAULT_INFRABUILDER_APPROLE_SECRET_ID }}"}' https://vault.ednz.fr/v1/auth/approle/login | jq -r .auth.client_token)
echo "vault_token=$VAULT_TOKEN" >> $GITHUB_OUTPUT
- name: Tofu init
run: tofu init
shell: bash
working-directory: ${{ gitea.workspace }}
- name: Tofu test
run: tofu test
shell: bash
working-directory: ${{ gitea.workspace }}

View File

@ -32,7 +32,7 @@ jobs:
- name: Install commitizen
run: pip3 install commitizen
shell: bash
working-directory: ./
working-directory: ${{ gitea.workspace }}
- name: Configure git credentials
uses: oleksiyrudenko/gha-git-credentials@v2
@ -46,9 +46,9 @@ jobs:
- name: Do release
run: cz -nr 21 bump --yes
shell: bash
working-directory: ./
working-directory: ${{ gitea.workspace }}
- name: Push release
run: git push && git push --tags
shell: bash
working-directory: ./
working-directory: ${{ gitea.workspace }}