Skip to contentSkip to conversation

Add .gitlab-ci.yml for pdf generation and testing on Gitlab.

PATCH Applied Leonardo Bras 3 participants 13 messages Feb 1, 2023 – Feb 3, 2023

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add .gitlab-ci.yml for pdf generation and testing on Gitlab.

Having this file merged on the main repository will trigger the Gitlab-CI on the mirror: https://gitlab.com/linux-kernel/perfbook/ after each push.

The way it works:
- Compile-test CodeSamples
- IF pass, build PDFs: regular, 1c, eb

---
 .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 .gitlab-ci.yml
.gitlab-ci.yml new file +34 -0
new file mode 100644
index 00000000..d131a4dc
@@ -0,0 +1,34 @@
+image: archlinux:latest
+
+stages:
+  - test
+  - build
+
+test_codesamples:
+    stage: test
+
+    before_script:
+        - pacman --noconfirm -Sy make gcc liburcu
+
+    script:
+        - make -C CodeSamples/
+
+generate_pdfs:
+    stage: build
+
+    before_script:
+        - pacman --noconfirm -Sy texlive-most fig2dev ghostscript graphviz inkscape wget make which fontconfig git ttf-dejavu gnu-free-fonts
+        - mkdir -p ~/.local/share/fonts && cp fonts/steel-city-comic.regular.ttf ~/.local/share/fonts/ && fc-cache
+        - wget https://sourceforge.net/projects/fig2ps/files/latest/download -O /dev/shm/fig2ps.tbz
+        - mkdir /dev/shm/build && tar -xjf /dev/shm/fig2ps.tbz -C /dev/shm/build --strip-components=1
+        - make install -C /dev/shm/build
+
+    script:
+        - make perfbook.pdf perfbook-1c.pdf perfbook-eb.pdf
+
+    artifacts:
+      paths:
+          - perfbook.pdf
+          - perfbook-1c.pdf
+          - perfbook-eb.pdf
+
Signature · 1 line
2.39.1
#1 lore raw
Quoted 8 lines · Leonardo Bras

Having this file merged on the main repository will trigger the Gitlab-CI on the mirror: https://gitlab.com/linux-kernel/perfbook/ after each push.

The way it works:
- Compile-test CodeSamples
- IF pass, build PDFs: regular, 1c, eb

Queued and pushed, thank you! Let's see how github (as oppoed to your gitlab) reacts to this. ;-)

Thanx, Paul

Quoted 48 lines
---
 .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 .gitlab-ci.yml
.gitlab-ci.yml new file +34 -0
new file mode 100644
index 00000000..d131a4dc
@@ -0,0 +1,34 @@
+image: archlinux:latest
+
+stages:
+  - test
+  - build
+
+test_codesamples:
+    stage: test
+
+    before_script:
+        - pacman --noconfirm -Sy make gcc liburcu
+
+    script:
+        - make -C CodeSamples/
+
+generate_pdfs:
+    stage: build
+
+    before_script:
+        - pacman --noconfirm -Sy texlive-most fig2dev ghostscript graphviz inkscape wget make which fontconfig git ttf-dejavu gnu-free-fonts
+        - mkdir -p ~/.local/share/fonts && cp fonts/steel-city-comic.regular.ttf ~/.local/share/fonts/ && fc-cache
+        - wget https://sourceforge.net/projects/fig2ps/files/latest/download -O /dev/shm/fig2ps.tbz
+        - mkdir /dev/shm/build && tar -xjf /dev/shm/fig2ps.tbz -C /dev/shm/build --strip-components=1
+        - make install -C /dev/shm/build
+
+    script:
+        - make perfbook.pdf perfbook-1c.pdf perfbook-eb.pdf
+
+    artifacts:
+      paths:
+          - perfbook.pdf
+          - perfbook-1c.pdf
+          - perfbook-eb.pdf
+
Signature · 1 line
2.39.1
#2 lore raw

Hi,

Quoted 4 lines · Paul E. McKenney
Quoted 3 lines · Leonardo Bras

Having this file merged on the main repository will trigger the Gitlab-CI on the mirror: https://gitlab.com/linux-kernel/perfbook/ after each push.

Quoted 8 lines
Quoted 5 lines

The way it works:
- Compile-test CodeSamples
- IF pass, build PDFs: regular, 1c, eb

Queued and pushed, thank you! Let's see how github (as oppoed to your gitlab) reacts to this. ;-)

I happen to have a perfbook repo at gitlab where CI is not set up. When I pushed this change, I got a mail from gitlab saying:

Quoted 3 lines

Subject: perfbook | Failed pipeline for gitlab-ci | 55c81b9b

Pipeline #764856510 has failed!

I don't think it is reasonable for Paul's repo to have gitlab specific settings like this.

Paul, can you please revert this?

Thanks, Akira

Quoted 2 lines

Thanx, Paul

#3 lore raw
Quoted 19 lines · Akira Yokosawa

Hi,

Quoted 4 lines · Paul E. McKenney
Quoted 3 lines · Leonardo Bras

Having this file merged on the main repository will trigger the Gitlab-CI on the mirror: https://gitlab.com/linux-kernel/perfbook/ after each push.

Quoted 8 lines
Quoted 5 lines

The way it works:
- Compile-test CodeSamples
- IF pass, build PDFs: regular, 1c, eb

Queued and pushed, thank you! Let's see how github (as oppoed to your gitlab) reacts to this. ;-)

I happen to have a perfbook repo at gitlab where CI is not set up. When I pushed this change, I got a mail from gitlab saying:

Quoted 8 lines
Quoted 3 lines

Subject: perfbook | Failed pipeline for gitlab-ci | 55c81b9b

Pipeline #764856510 has failed!

I don't think it is reasonable for Paul's repo to have gitlab specific settings like this.

Paul, can you please revert this?

Done, and apologies!

Leonardo, would another approach be to create a separate branch in your repo that contained this file, then automatically cherry-pick or merge it with each perfbook update?

Thanx, Paul

#4 lore raw
Quoted 17 lines · Paul E. McKenney
Quoted 16 lines · Akira Yokosawa

Hi,

Quoted 12 lines · Paul E. McKenney
Quoted 8 lines · Leonardo Bras

Having this file merged on the main repository will trigger the Gitlab-CI on the mirror: https://gitlab.com/linux-kernel/perfbook/ after each push.

The way it works:
- Compile-test CodeSamples
- IF pass, build PDFs: regular, 1c, eb

Queued and pushed, thank you! Let's see how github (as oppoed to your gitlab) reacts to this. ;-)

Quoted 6 lines
Quoted 6 lines

I happen to have a perfbook repo at gitlab where CI is not set up. When I pushed this change, I got a mail from gitlab saying:

Quoted 3 lines

Subject: perfbook | Failed pipeline for gitlab-ci | 55c81b9b

Pipeline #764856510 has failed!

That's odd, I wonder why have it failed.

Quoted 6 lines
Quoted 5 lines

I don't think it is reasonable for Paul's repo to have gitlab specific settings like this.

Paul, can you please revert this?

Quoted 7 lines

Done, and apologies!

Leonardo, would another approach be to create a separate branch in your repo that contained this file, then automatically cherry-pick or merge it with each perfbook update?

Thanx, Paul

Sure, that would work much better, but I need to find out how to do this on Gitlab side.

I will reply here when I find any answers.

Thanks!

#5 lore raw
Quoted 39 lines · Leonardo Brás
Quoted 17 lines · Paul E. McKenney
Quoted 16 lines · Akira Yokosawa

Hi,

Quoted 12 lines · Paul E. McKenney
Quoted 8 lines · Leonardo Bras

Having this file merged on the main repository will trigger the Gitlab-CI on the mirror: https://gitlab.com/linux-kernel/perfbook/ after each push.

The way it works:
- Compile-test CodeSamples
- IF pass, build PDFs: regular, 1c, eb

Queued and pushed, thank you! Let's see how github (as oppoed to your gitlab) reacts to this. ;-)

Quoted 6 lines
Quoted 6 lines

I happen to have a perfbook repo at gitlab where CI is not set up. When I pushed this change, I got a mail from gitlab saying:

Quoted 3 lines

Subject: perfbook | Failed pipeline for gitlab-ci | 55c81b9b

Pipeline #764856510 has failed!

That's odd, I wonder why have it failed.

Quoted 12 lines
Quoted 5 lines

I don't think it is reasonable for Paul's repo to have gitlab specific settings like this.

Paul, can you please revert this?

Done, and apologies!

Leonardo, would another approach be to create a separate branch in your repo that contained this file, then automatically cherry-pick or merge it with each perfbook update?

Quoted 9 lines
Quoted 1 line

Thanx, Paul

Sure, that would work much better, but I need to find out how to do this on Gitlab side.

I will reply here when I find any answers.

Thanks!

It looks like it can be done by "Running CI/CD for external repositories".

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Best regards,
Leo

#6 lore raw

On Thu, 02 Feb 2023 01:37:02 -0300, Leonardo Brás wrote:
[...]

Quoted 9 lines

It looks like it can be done by "Running CI/CD for external repositories".

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Hi Leonardo,

I noticed a minor glitch in the generated PDFs.
They don't have Git commit info in the title page and footer area of pages.

I can't tell what went wrong, but expected autodate.tex should look like:

-----
\date{February 1, 2023 \\ Commit: \texttt{v2022.09.25a-81-g4327c1f3809e}} \newcommand{\commityear}{2023} \newcommand{\commitid}{v2022.09.25a-81-g4327c1f3809e} \IfQqzBg{}{\setboolean{qqzbg}{false}}
% tcolorbox version: 5.1
\tcbsetforeverylayer{autoparskip}
-----

It is not kept in the artifact, so I'm just guessing.
I guess utilities/autodate.sh failed to see .git/ in the build directory and generated the following based on the build date instead:

-----
\date{February 2, 2023 }
\newcommand{\commityear}{2023}
\newcommand{\commitid}{}
\IfQqzBg{}{\setboolean{qqzbg}{false}}
% tcolorbox version: 5.1
\tcbsetforeverylayer{autoparskip}
-----

Not a big deal, but can you look into this?

BTW, I just requested a permission for accessing your repo.

Thanks, Akira

Quoted 3 lines

Best regards,
Leo

#7 lore raw
Quoted 4 lines · Akira Yokosawa

On Thu, 02 Feb 2023 01:37:02 -0300, Leonardo Brás wrote:
[...]

Quoted 2 lines

It looks like it can be done by "Running CI/CD for external repositories".

Nah, it looks like this won't work either. After my patch on top of master, it's already warning about diverging repositories when I try to sync.

Another solution I could find:
- Change the patch I sent before to keep the file on another directory, even with a different name: this will not trigger the build for anyone.
- Change my repository config to trigger the CI from that file.

The file would only be a random YML file in the repo. Would that be ok?

Quoted 8 lines
Quoted 7 lines

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Quoted 7 lines

Hi Leonardo,

I noticed a minor glitch in the generated PDFs.
They don't have Git commit info in the title page and footer area of pages.

I can't tell what went wrong, but expected autodate.tex should look like:

I found it out: gitlab was doing a shallow clone, and the previous tag was not in the commits, so I modified the Gitlab config so it does a complete clone of the repository instead.

The last output of the pipeline seems to have been correct, please check:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3705185694/artifacts/browse

Quoted 23 lines

-----
\date{February 1, 2023 \\ Commit: \texttt{v2022.09.25a-81-g4327c1f3809e}} \newcommand{\commityear}{2023} \newcommand{\commitid}{v2022.09.25a-81-g4327c1f3809e} \IfQqzBg{}{\setboolean{qqzbg}{false}}
% tcolorbox version: 5.1
\tcbsetforeverylayer{autoparskip}
-----

It is not kept in the artifact, so I'm just guessing.
I guess utilities/autodate.sh failed to see .git/ in the build directory and generated the following based on the build date instead:

-----
\date{February 2, 2023 }
\newcommand{\commityear}{2023}
\newcommand{\commitid}{}
\IfQqzBg{}{\setboolean{qqzbg}{false}}
% tcolorbox version: 5.1
\tcbsetforeverylayer{autoparskip}
-----

Quoted 3 lines

Not a big deal, but can you look into this?

BTW, I just requested a permission for accessing your repo.

Let's put that on hold: I think it will be necessary to delete this repo and import again from kernel.org if the pipeline don't work fine for next commits.

Quoted 4 lines

Thanks, Akira

Thank you for reporting the issue!

Best regards,
Leo

#8 lore raw

Hi,

Quoted 9 lines · Leonardo Brás
Quoted 4 lines · Akira Yokosawa

On Thu, 02 Feb 2023 01:37:02 -0300, Leonardo Brás wrote:
[...]

Quoted 2 lines

It looks like it can be done by "Running CI/CD for external repositories".

Nah, it looks like this won't work either. After my patch on top of master, it's already warning about diverging repositories when I try to sync.

Quoted 7 lines

Another solution I could find:
- Change the patch I sent before to keep the file on another directory, even with a different name: this will not trigger the build for anyone.
- Change my repository config to trigger the CI from that file.

The file would only be a random YML file in the repo. Would that be ok?

Hmm, yes, I think I can live with it.

Quoted 15 lines
Quoted 15 lines
Quoted 8 lines

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Hi Leonardo,

I noticed a minor glitch in the generated PDFs.
They don't have Git commit info in the title page and footer area of pages.

Quoted 5 lines
Quoted 1 line

I can't tell what went wrong, but expected autodate.tex should look like:

I found it out: gitlab was doing a shallow clone, and the previous tag was not in the commits, so I modified the Gitlab config so it does a complete clone of the repository instead.

Aha! The script has never tested under a shallow clone... Let me see if I can improve its behavior.

Quoted 2 lines

The last output of the pipeline seems to have been correct, please check:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3705185694/artifacts/browse

Apparently, the commit id does not make sense in Paul's repo. But the random YML file approach should resolve it.

Thanks, Akira

#9 lore raw
Quoted 43 lines · Akira Yokosawa

Hi,

Quoted 9 lines · Leonardo Brás
Quoted 4 lines · Akira Yokosawa

On Thu, 02 Feb 2023 01:37:02 -0300, Leonardo Brás wrote:
[...]

Quoted 2 lines

It looks like it can be done by "Running CI/CD for external repositories".

Nah, it looks like this won't work either. After my patch on top of master, it's already warning about diverging repositories when I try to sync.

Quoted 7 lines

Another solution I could find:
- Change the patch I sent before to keep the file on another directory, even with a different name: this will not trigger the build for anyone.
- Change my repository config to trigger the CI from that file.

The file would only be a random YML file in the repo. Would that be ok?

Hmm, yes, I think I can live with it.

Quoted 15 lines
Quoted 15 lines
Quoted 8 lines

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Hi Leonardo,

I noticed a minor glitch in the generated PDFs.
They don't have Git commit info in the title page and footer area of pages.

Quoted 5 lines
Quoted 1 line

I can't tell what went wrong, but expected autodate.tex should look like:

I found it out: gitlab was doing a shallow clone, and the previous tag was not in the commits, so I modified the Gitlab config so it does a complete clone of the repository instead.

Quoted 8 lines

Aha! The script has never tested under a shallow clone... Let me see if I can improve its behavior.

Quoted 2 lines

The last output of the pipeline seems to have been correct, please check:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3705185694/artifacts/browse

Apparently, the commit id does not make sense in Paul's repo. But the random YML file approach should resolve it.

Apologies, I left it untracked. There is now a Leonardo.2023.02.01a branch that references it.

Thanx, Paul

#10 lore raw
Quoted 47 lines · Paul E. McKenney
Quoted 46 lines · Akira Yokosawa

Hi,

Quoted 9 lines · Leonardo Brás
Quoted 4 lines · Akira Yokosawa

On Thu, 02 Feb 2023 01:37:02 -0300, Leonardo Brás wrote:
[...]

Quoted 2 lines

It looks like it can be done by "Running CI/CD for external repositories".

Nah, it looks like this won't work either. After my patch on top of master, it's already warning about diverging repositories when I try to sync.

Quoted 7 lines

Another solution I could find:
- Change the patch I sent before to keep the file on another directory, even with a different name: this will not trigger the build for anyone.
- Change my repository config to trigger the CI from that file.

The file would only be a random YML file in the repo. Would that be ok?

Hmm, yes, I think I can live with it.

Quoted 15 lines
Quoted 15 lines
Quoted 8 lines

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Hi Leonardo,

I noticed a minor glitch in the generated PDFs.
They don't have Git commit info in the title page and footer area of pages.

Quoted 5 lines
Quoted 1 line

I can't tell what went wrong, but expected autodate.tex should look like:

I found it out: gitlab was doing a shallow clone, and the previous tag was not in the commits, so I modified the Gitlab config so it does a complete clone of the repository instead.

Aha! The script has never tested under a shallow clone... Let me see if I can improve its behavior.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The last output of the pipeline seems to have been correct, please check:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3705185694/artifacts/browse

Apparently, the commit id does not make sense in Paul's repo. But the random YML file approach should resolve it.

Apologies, I left it untracked. There is now a Leonardo.2023.02.01a branch that references it.

I mean the commit id 81974e57 presented in the artifacts is of the commit Leonardo made on his own:

    https://gitlab.com/linux-kernel/perfbook/-/commit/81974e57bed4

        Thanks, Akira
Quoted 2 lines

Thanx, Paul

#11 lore raw
Quoted 54 lines · Akira Yokosawa
Quoted 53 lines · Paul E. McKenney
Quoted 51 lines · Akira Yokosawa

Hi,

Quoted 9 lines · Leonardo Brás
Quoted 4 lines · Akira Yokosawa

On Thu, 02 Feb 2023 01:37:02 -0300, Leonardo Brás wrote:
[...]

Quoted 2 lines

It looks like it can be done by "Running CI/CD for external repositories".

Nah, it looks like this won't work either. After my patch on top of master, it's already warning about diverging repositories when I try to sync.

Quoted 7 lines

Another solution I could find:
- Change the patch I sent before to keep the file on another directory, even with a different name: this will not trigger the build for anyone.
- Change my repository config to trigger the CI from that file.

The file would only be a random YML file in the repo. Would that be ok?

Hmm, yes, I think I can live with it.

Quoted 15 lines
Quoted 15 lines
Quoted 8 lines

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Hi Leonardo,

I noticed a minor glitch in the generated PDFs.
They don't have Git commit info in the title page and footer area of pages.

Quoted 5 lines
Quoted 1 line

I can't tell what went wrong, but expected autodate.tex should look like:

I found it out: gitlab was doing a shallow clone, and the previous tag was not in the commits, so I modified the Gitlab config so it does a complete clone of the repository instead.

Aha! The script has never tested under a shallow clone... Let me see if I can improve its behavior.

Quoted 2 lines

The last output of the pipeline seems to have been correct, please check:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3705185694/artifacts/browse

Apparently, the commit id does not make sense in Paul's repo. But the random YML file approach should resolve it.

Quoted 7 lines
Quoted 2 lines

Apologies, I left it untracked. There is now a Leonardo.2023.02.01a branch that references it.

I mean the commit id 81974e57 presented in the artifacts is of the commit Leonardo made on his own:

    https://gitlab.com/linux-kernel/perfbook/-/commit/81974e57bed4

You are right, that is not the Leonardo.2023.02.01a commit. Apologies for my confusion!

Thanx, Paul

#12 lore raw
Quoted 20 lines · Paul E. McKenney
Quoted 19 lines · Akira Yokosawa
Quoted 18 lines · Paul E. McKenney
Quoted 17 lines · Akira Yokosawa

Hi,

Quoted 14 lines · Leonardo Brás
Quoted 4 lines · Akira Yokosawa

On Thu, 02 Feb 2023 01:37:02 -0300, Leonardo Brás wrote:
[...]

Quoted 2 lines

It looks like it can be done by "Running CI/CD for external repositories".

Nah, it looks like this won't work either. After my patch on top of master, it's already warning about diverging repositories when I try to sync.

Another solution I could find:
- Change the patch I sent before to keep the file on another directory, even with a different name: this will not trigger the build for anyone.
- Change my repository config to trigger the CI from that file.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

The file would only be a random YML file in the repo. Would that be ok?

Hmm, yes, I think I can live with it.

Great!

I created a patch for including the new yml file.

I created a new repo mirroring from the kernel.org repo, and created a new branch with the above patch. Nothing happened on push.

Then I configured the correct yml file on Gitlab (details on the patch), and a new push trigered the pipelines, so the desired effect was achieved.

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 10 lines
Quoted 9 lines

I removed my previous repository and then imported perfbook again using the above mentioned mode. According to the man page, it will run CI for the project whenever a new push to the referenced repository happens.

So it's just a matter of waiting a new commit getting push'ed to see if it will be working.

Quoted 7 lines

Hi Leonardo,

I noticed a minor glitch in the generated PDFs.
They don't have Git commit info in the title page and footer area of pages.

I can't tell what went wrong, but expected autodate.tex should look like:

I found it out: gitlab was doing a shallow clone, and the previous tag was not in the commits, so I modified the Gitlab config so it does a complete clone of the repository instead.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Aha! The script has never tested under a shallow clone... Let me see if I can improve its behavior.

Quoted 2 lines

The last output of the pipeline seems to have been correct, please check:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3705185694/artifacts/browse

Apparently, the commit id does not make sense in Paul's repo.

Yes, it was a commit in my personal tree.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

But the random YML file approach should resolve it.

Agree.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Apologies, I left it untracked. There is now a Leonardo.2023.02.01a branch that references it.

I mean the commit id 81974e57 presented in the artifacts is of the commit Leonardo made on his own:

Quoted 6 lines
Quoted 1 line
    https://gitlab.com/linux-kernel/perfbook/-/commit/81974e57bed4

You are right, that is not the Leonardo.2023.02.01a commit. Apologies for my confusion!

Thanx, Paul

Please take a look in the new patch, it should sort everything out.

Best regards,
Leo