test PR #2595
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
name: CI | ||
jobs: | ||
flatpak: | ||
name: Flatpak | ||
runs-on: ubuntu-latest | ||
container: | ||
image: bilelmoussaoui/flatpak-github-actions:gnome-44 | ||
options: --privileged | ||
strategy: | ||
matrix: | ||
arch: [x86_64, aarch64] | ||
# Don't fail the whole workflow if one architecture fails | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install deps | ||
run: | | ||
dnf -y install docker | ||
- name: Set up QEMU | ||
id: qemu | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: arm64 | ||
- name: Build Flatpak | ||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6 | ||
with: | ||
bundle: graphs.flatpak | ||
run-tests: true | ||
manifest-path: se.sjoerd.Graphs.json | ||
cache-key: flatpak-builder-${{ github.sha }} | ||
arch: ${{ matrix.arch }} | ||
snap: | ||
name: Snap | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
architecture: | ||
- amd64 | ||
- arm64 | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup snapcraft | ||
env: | ||
LP_BUILD_SECRET: ${{ secrets.LP_BUILD_SECRET }} | ||
run: | | ||
sudo snap install snapcraft --classic | ||
# Setup Launchpad credentials | ||
mkdir -p ~/.local/share/snapcraft/provider/launchpad | ||
echo "$LP_BUILD_SECRET" > ~/.local/share/snapcraft/provider/launchpad/credentials | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Actions" | ||
sudo apt-get update; sudo apt-get install -y moreutils | ||
- name: Build | ||
id: build | ||
env: | ||
ARCHITECTURE: ${{ matrix.architecture }} | ||
run: | | ||
# Remove the architecture definition from the snapcraft.yaml due to: | ||
# https://bugs.launchpad.net/snapcraft/+bug/1885150 | ||
cat snap/snapcraft.yaml | yq 'del(.architectures)' | sponge snap/snapcraft.yaml | ||
snapcraft remote-build --launchpad-accept-public-upload --build-for=${ARCHITECTURE} | ||
release_line=$(grep -m 1 '<release version=' "data/se.sjoerd.Graphs.appdata.xml.in.in") | ||
version=$(echo "$release_line" | sed -n 's/.*version="\([^"]*\)".*/\1/p') | ||
if [ ! -f "graphs_${version}_${ARCHITECTURE}.snap" ]; then | ||
echo "Snap file not found, check the build log below to find error" | ||
cat graphs_${ARCHITECTURE}.txt | ||
exit 1 | ||
fi | ||
cat "graphs_${ARCHITECTURE}.txt" | ||
echo "snap=graphs_${version}_${ARCHITECTURE}.snap" >> "$GITHUB_OUTPUT" | ||
- name: Publish to edge channel | ||
uses: snapcore/action-publish@v1 | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | ||
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} | ||
with: | ||
snap: ${{ steps.build.outputs.snap }} | ||
release: edge | ||
flake8-lint: | ||
name: flake8 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python environment | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
# Install flake8 extensions (this step is not required. Default is "None"). | ||
- name: Set up flake8 | ||
run: pip install flake8-docstrings flake8-simplify flake8-unused-arguments flake8-quotes flake8-bugbear flake8-pie flake8-print flake8-warnings flake8-commas flake8-builtins flake8-import-order pep8-naming | ||
- name: flake8 Lint | ||
uses: reviewdog/action-flake8@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
fail_on_error: true | ||
name: Update POT on PR | ||
on: | ||
pull_request: | ||
paths: | ||
- '**/*.py' # Adjust the path to match your project's structure | ||
jobs: | ||
update-pot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
# Add any additional dependencies needed for your project | ||
- name: Update POT file | ||
run: | | ||
# Add the command to update the POT file | ||
xgettext --output=your_project.pot your_source_code/*.py | ||
- name: Commit and push changes | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add your_project.pot | ||
git commit -m "Update POT file" || true # Ignore if there are no changes | ||
git push |