Skip to contentSkip to conversation

Add Github Action CI workflow

PATCH In review Rob Herring 3 participants 4 messages Jun 14, 2021 – Jun 17, 2021 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add Github Action CI workflow

Travis-ci.org is going away and moving to Travis-ci.com requires some work. It would probably involve fixing authentication issues yet again. Instead, let's just move to a GH actions job which is fairly trivial to setup. This has the side benefit of CI will run on anyone's fork without further setup.

As part of this, the specification file name gains a 'git-describe' based version number.

---
 .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 .github/workflows/ci.yml
.github/workflows/ci.yml new file +60 -0
new file mode 100644
index 000000000000..f8fe08d52cb0
@@ -0,0 +1,60 @@
+name: Github Action CI
+
+on:
+  push:
+    branches: 
+    - '*'
+    tags:
+    - 'v*'
+  pull_request:
+    branches: 
+      master
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+
+    - name: install
+      run: |
+        sudo apt-get update
+        sudo apt-get install latexmk libalgorithm-diff-perl texlive texlive-latex-extra texlive-humanities graphviz
+        pip3 install --user mako
+        pip3 install --user typing
+        pip3 install --user Sphinx
+        pip3 install --user codespell
+
+    - name: build pdf
+      run: |
+        make latexpdf
+        git fetch --tags --force # Needed to make git-describe work
+        mv build/latex/devicetree-specification.pdf build/latex/devicetree-specification-$(git describe).pdf
+    - name: build html
+      run: make html
+    - name: build singlehtml
+      run: make singlehtml
+
+    - name: upload
+      uses: actions/upload-artifact@v2
+      with:
+        name: artifacts
+        path: |
+          build/latex/devicetree-specification-*.pdf
+
+    - name: deploy
+      uses: peaceiris/actions-gh-pages@v3
+      with:
+        github_token: ${{ secrets.GITHUB_TOKEN }}
+        publish_dir: ./build/singlehtml
+
+    - name: release
+      uses: softprops/action-gh-release@v1
+      if: startsWith(github.ref, 'refs/tags/')
+      with:
+        files: build/latex/devicetree-specification-*.pdf
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Signature · 1 line
2.27.0

A message that is not in the archive (sent off-list or not yet received): 20210614173623.1125220-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

Reviewed-by
#2 lore raw

Hi Rob,

Quoted 7 lines · Rob Herring

Travis-ci.org is going away and moving to Travis-ci.com requires some work. It would probably involve fixing authentication issues yet again. Instead, let's just move to a GH actions job which is fairly trivial to setup. This has the side benefit of CI will run on anyone's fork without further setup.

Quoted 8 lines

As part of this, the specification file name gains a 'git-describe' based version number.

---
 .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 .github/workflows/ci.yml

Questions below

Quoted 25 lines
.github/workflows/ci.yml new file +18 -0
new file mode 100644
index 000000000000..f8fe08d52cb0
@@ -0,0 +1,60 @@
+name: Github Action CI
+
+on:
+  push:
+    branches:
+    - '*'
+    tags:
+    - 'v*'
+  pull_request:
+    branches:
+      master
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2

.github/workflows/ci.yml line 28

Quoted 10 lines
.github/workflows/ci.yml new file +10 -0
+      with:
+        fetch-depth: 0
+
+    - name: install
+      run: |
+        sudo apt-get update
+        sudo apt-get install latexmk libalgorithm-diff-perl texlive texlive-latex-extra texlive-humanities graphviz
+        pip3 install --user mako
+        pip3 install --user typing
+        pip3 install --user Sphinx

Does this need the capital S ? Can we use apt install instead?

Quoted 13 lines
.github/workflows/ci.yml new file +13 -0
+        pip3 install --user codespell
+
+    - name: build pdf
+      run: |
+        make latexpdf
+        git fetch --tags --force # Needed to make git-describe work
+        mv build/latex/devicetree-specification.pdf build/latex/devicetree-specification-$(git describe).pdf
+    - name: build html
+      run: make html
+    - name: build singlehtml
+      run: make singlehtml
+
+    - name: upload

.github/workflows/ci.yml line 51

Quoted 10 lines
.github/workflows/ci.yml new file +10 -0
+      uses: actions/upload-artifact@v2
+      with:
+        name: artifacts
+        path: |
+          build/latex/devicetree-specification-*.pdf
+
+    - name: deploy
+      uses: peaceiris/actions-gh-pages@v3
+      with:
+        github_token: ${{ secrets.GITHUB_TOKEN }}

What do the spaces instead the {} do? From the docs it looks like this is a quirk of github?

.github/workflows/ci.yml line 56

Quoted 5 lines
.github/workflows/ci.yml new file +5 -0
+        publish_dir: ./build/singlehtml
+
+    - name: release
+      uses: softprops/action-gh-release@v1
+      if: startsWith(github.ref, 'refs/tags/')

So we don't need ${{}} around this one?

Quoted 7 lines
.github/workflows/ci.yml new file +4 -1
+      with:
+        files: build/latex/devicetree-specification-*.pdf
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
--

2.27.0

Regards,
Simon

A message that is not in the archive (sent off-list or not yet received): CAPnjgZ27P9mXRBzcHeoVHF1OyLqS95NnJQ7dAvNnhMf-6XUa-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 14 lines · Simon Glass

Hi Rob,

Quoted 10 lines · Rob Herring

Travis-ci.org is going away and moving to Travis-ci.com requires some work. It would probably involve fixing authentication issues yet again. Instead, let's just move to a GH actions job which is fairly trivial to setup. This has the side benefit of CI will run on anyone's fork without further setup.

As part of this, the specification file name gains a 'git-describe' based version number.

Quoted 7 lines
Quoted 5 lines
---
 .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 .github/workflows/ci.yml

Thanks for looking.

Quoted 32 lines

Questions below

Quoted 29 lines
.github/workflows/ci.yml new file +22 -0
new file mode 100644
index 000000000000..f8fe08d52cb0
@@ -0,0 +1,60 @@
+name: Github Action CI
+
+on:
+  push:
+    branches:
+    - '*'
+    tags:
+    - 'v*'
+  pull_request:
+    branches:
+      master
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+
+    - name: install
Quoted 8 lines

.github/workflows/ci.yml line 28

Quoted 6 lines
.github/workflows/ci.yml new file +6 -0
+      run: |
+        sudo apt-get update
+        sudo apt-get install latexmk libalgorithm-diff-perl texlive texlive-latex-extra texlive-humanities graphviz
+        pip3 install --user mako
+        pip3 install --user typing
+        pip3 install --user Sphinx

Does this need the capital S ?

I believe so. This is copy-paste from the TravisCI job.

Quoted 1 line

Can we use apt install instead?

Perhaps. I think the issue here was the TravisCI using ancient ubuntu versions and we needed a newer version of Sphinx at some point. GH is the latest LTS, so it should be new enough.

Quoted 19 lines
Quoted 19 lines
.github/workflows/ci.yml new file +18 -0
+        pip3 install --user codespell
+
+    - name: build pdf
+      run: |
+        make latexpdf
+        git fetch --tags --force # Needed to make git-describe work
+        mv build/latex/devicetree-specification.pdf build/latex/devicetree-specification-$(git describe).pdf
+    - name: build html
+      run: make html
+    - name: build singlehtml
+      run: make singlehtml
+
+    - name: upload
+      uses: actions/upload-artifact@v2
+      with:
+        name: artifacts
+        path: |
+          build/latex/devicetree-specification-*.pdf
Quoted 8 lines

.github/workflows/ci.yml line 51

Quoted 5 lines
.github/workflows/ci.yml new file +5 -0
+
+    - name: deploy
+      uses: peaceiris/actions-gh-pages@v3
+      with:
+        github_token: ${{ secrets.GITHUB_TOKEN }}

What do the spaces instead the {} do? From the docs it looks like this is a quirk of github?

I don't know really.

Quoted 7 lines

.github/workflows/ci.yml line 56

Quoted 5 lines
.github/workflows/ci.yml new file +5 -0
+        publish_dir: ./build/singlehtml
+
+    - name: release
+      uses: softprops/action-gh-release@v1
+      if: startsWith(github.ref, 'refs/tags/')

So we don't need ${{}} around this one?

Evidently not. On both of these, I just follow what the action's docs say to add.

It's nice and worrying at the same time to just use other people's actions.

Rob

A message that is not in the archive (sent off-list or not yet received): CAL_JsqJrvFUiqL_ehzbU3r8M+PfcjbL7Bx8a4afWN3F6-xFLbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw
Quoted 66 lines · Rob Herring
Quoted 14 lines · Simon Glass

Hi Rob,

Quoted 10 lines · Rob Herring

Travis-ci.org is going away and moving to Travis-ci.com requires some work. It would probably involve fixing authentication issues yet again. Instead, let's just move to a GH actions job which is fairly trivial to setup. This has the side benefit of CI will run on anyone's fork without further setup.

As part of this, the specification file name gains a 'git-describe' based version number.

Quoted 7 lines
Quoted 5 lines
---
 .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 .github/workflows/ci.yml

Thanks for looking.

Quoted 32 lines

Questions below

Quoted 29 lines
.github/workflows/ci.yml new file +22 -0
new file mode 100644
index 000000000000..f8fe08d52cb0
@@ -0,0 +1,60 @@
+name: Github Action CI
+
+on:
+  push:
+    branches:
+    - '*'
+    tags:
+    - 'v*'
+  pull_request:
+    branches:
+      master
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+
+    - name: install
Quoted 8 lines

.github/workflows/ci.yml line 28

Quoted 6 lines
.github/workflows/ci.yml new file +6 -0
+      run: |
+        sudo apt-get update
+        sudo apt-get install latexmk libalgorithm-diff-perl texlive texlive-latex-extra texlive-humanities graphviz
+        pip3 install --user mako
+        pip3 install --user typing
+        pip3 install --user Sphinx

Does this need the capital S ?

Quoted 7 lines

I believe so. This is copy-paste from the TravisCI job.

Quoted 1 line

Can we use apt install instead?

Perhaps. I think the issue here was the TravisCI using ancient ubuntu versions and we needed a newer version of Sphinx at some point. GH is the latest LTS, so it should be new enough.

On a slight tangent, perhaps a requirements.txt so that in CI you just:
pip3 install --user --requirement path/to/requirements.txt

and as a bonus it documents what modules someone needs to build outside of CI and future module needs are handled without a CI change.

Signature · 1 line
Tom