Skip to content

Commit c88463f

Browse files
authored
Merge pull request #201 from italia/dev
CI branching strategies for alignment with eudi-wallet-it-python
2 parents bd61669 + 835eb62 commit c88463f

1 file changed

Lines changed: 77 additions & 55 deletions

File tree

.github/workflows/python-app.yml

Lines changed: 77 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,58 +21,80 @@ jobs:
2121
- '3.10'
2222

2323
steps:
24-
- uses: actions/checkout@v3
25-
- name: Install xmlsec1
26-
run: sudo apt-get install -y xmlsec1
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v4
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
- name: Install Python dependencies
32-
run: |
33-
pip install --upgrade pip
34-
pip install flake8
35-
pip install "spid-sp-test>=1.2.17"
36-
- name: Inspect Python dependencies
37-
run: |
38-
pip list
39-
- name: Lint with flake8
40-
run: |
41-
## stop the build if there are Python syntax errors or undefined names
42-
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics iam-proxy-italia-project
43-
## exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44-
flake8 --max-line-length 120 --count --exit-zero --statistics iam-proxy-italia-project
45-
- name: docker compose
46-
run: |
47-
cd Docker-compose
48-
./run-docker-compose.sh
49-
docker ps -a
50-
- name: djangosaml2 SP metadata to Proxy
51-
run: |
52-
wget http://localhost:8000/saml2/metadata -O Docker-compose/satosa-project/metadata/sp/djangosaml2_sp.xml
53-
- name: Inspect djangosaml2 SP metadata
54-
run: |
55-
cat Docker-compose/satosa-project/metadata/sp/djangosaml2_sp.xml
56-
- name: Inspect Satosa status
57-
run: |
58-
docker container inspect iam-proxy-italia
59-
docker container logs iam-proxy-italia
60-
- name: Copy Satosa IDP Metadata to djangosaml2 SP
61-
run: |
62-
wget -vd --no-check-certificate https://localhost/Saml2IDP/metadata -O Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/iam-proxy-italia.xml
63-
- name: Inspect Satosa IDP Metadata
64-
run: |
65-
cat Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/iam-proxy-italia.xml
66-
- name: spid-sp-test SPID metadata, requests and responses
67-
run: |
68-
cd Docker-compose/satosa-project
69-
spid_sp_test --idp-metadata > metadata/idp/spid-sp-test.xml
70-
spid_sp_test --metadata-url https://localhost/spidSaml2/metadata --authn-url "http://localhost:8000/saml2/login/?idp=https://localhost/Saml2IDP/metadata&next=/saml2/echo_attributes&idphint=https%253A%252F%252Flocalhost%253A8443" -ap spid_sp_test.plugins.authn_request.SatosaSaml2Spid --extra --debug ERROR -tr
71-
- name: spid-sp-test CIE id metadata
72-
run: |
73-
cd Docker-compose/satosa-project
74-
spid_sp_test --profile cie-sp-public --metadata-url https://localhost/cieSaml2/metadata
75-
- name: spid-sp-test eIDAS FiCEP metadata
76-
run: |
77-
cd Docker-compose/satosa-project
78-
spid_sp_test --profile ficep-eidas-sp --metadata-url https://localhost/spidSaml2/metadata
24+
- uses: actions/checkout@v3
25+
- name: Install xmlsec1
26+
run: sudo apt-get install -y xmlsec1
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install Python dependencies
32+
run: |
33+
pip install --upgrade pip
34+
pip install flake8
35+
pip install "spid-sp-test>=1.2.17"
36+
- name: Inspect Python dependencies
37+
run: |
38+
pip list
39+
- name: Lint with flake8
40+
run: |
41+
## stop the build if there are Python syntax errors or undefined names
42+
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics iam-proxy-italia-project
43+
## exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44+
flake8 --max-line-length 120 --count --exit-zero --statistics iam-proxy-italia-project
45+
46+
- name: Patch pyproject.toml if same branch exists in eudi-wallet-it-python
47+
env:
48+
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
49+
run: |
50+
echo "Current branch: $CURRENT_BRANCH"
51+
if [ "$CURRENT_BRANCH" != "master" ]; then
52+
echo "Checking if branch '$CURRENT_BRANCH' exists in eudi-wallet-it-python..."
53+
if git ls-remote --heads https://github.com/italia/eudi-wallet-it-python.git $CURRENT_BRANCH | grep -q $CURRENT_BRANCH; then
54+
echo "Branch found! Patching pyproject.toml..."
55+
# PEP 508 style
56+
sed -i 's|git+https://github.com/italia/eudi-wallet-it-python|git+https://github.com/italia/eudi-wallet-it-python.git@'"$CURRENT_BRANCH"'|g' pyproject.toml
57+
# Table style
58+
sed -i 's|git = "https://github.com/italia/eudi-wallet-it-python"|git = "https://github.com/italia/eudi-wallet-it-python.git", rev = "'"$CURRENT_BRANCH"'"|g' pyproject.toml
59+
rm -f poetry.lock
60+
else
61+
echo "No matching branch found. Using default pyproject.toml."
62+
fi
63+
else
64+
echo "Current branch is master → no patch needed."
65+
fi
66+
67+
- name: docker compose
68+
run: |
69+
cd Docker-compose
70+
./run-docker-compose.sh
71+
docker ps -a
72+
- name: djangosaml2 SP metadata to Proxy
73+
run: |
74+
wget http://localhost:8000/saml2/metadata -O Docker-compose/satosa-project/metadata/sp/djangosaml2_sp.xml
75+
- name: Inspect djangosaml2 SP metadata
76+
run: |
77+
cat Docker-compose/satosa-project/metadata/sp/djangosaml2_sp.xml
78+
- name: Inspect Satosa status
79+
run: |
80+
docker container inspect iam-proxy-italia
81+
docker container logs iam-proxy-italia
82+
- name: Copy Satosa IDP Metadata to djangosaml2 SP
83+
run: |
84+
wget -vd --no-check-certificate https://localhost/Saml2IDP/metadata -O Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/iam-proxy-italia.xml
85+
- name: Inspect Satosa IDP Metadata
86+
run: |
87+
cat Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/iam-proxy-italia.xml
88+
- name: spid-sp-test SPID metadata, requests and responses
89+
run: |
90+
cd Docker-compose/satosa-project
91+
spid_sp_test --idp-metadata > metadata/idp/spid-sp-test.xml
92+
spid_sp_test --metadata-url https://localhost/spidSaml2/metadata --authn-url "http://localhost:8000/saml2/login/?idp=https://localhost/Saml2IDP/metadata&next=/saml2/echo_attributes&idphint=https%253A%252F%252Flocalhost%253A8443" -ap spid_sp_test.plugins.authn_request.SatosaSaml2Spid --extra --debug ERROR -tr
93+
- name: spid-sp-test CIE id metadata
94+
run: |
95+
cd Docker-compose/satosa-project
96+
spid_sp_test --profile cie-sp-public --metadata-url https://localhost/cieSaml2/metadata
97+
- name: spid-sp-test eIDAS FiCEP metadata
98+
run: |
99+
cd Docker-compose/satosa-project
100+
spid_sp_test --profile ficep-eidas-sp --metadata-url https://localhost/spidSaml2/metadata

0 commit comments

Comments
 (0)