Skip to content

Update action runners #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .github/actions/discord-send/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ runs:
MSG_COLOR: ${{ inputs.color }}
MSG_VALUE: ${{ inputs.message }}
run: |
payload="$(jq --null-input --compact-output --monochrome-output \
--arg title "$MSG_TITLE" \
--arg link "$MSG_LINK" \
--arg color "$MSG_COLOR" \
--arg message "$MSG_VALUE" \
'{
username: "Toltec",
avatar_url: "https://avatars0.githubusercontent.com/u/71158884",
embeds: [{
title: $title,
url: $link,
color: $color,
description: $message,
}]
}')"
curl --silent --show-error --fail \
--header "Content-Type: application/json" \
--data "$payload" \
'https://discord.com/api/webhooks/${{ inputs.channel }}/${{ inputs.token }}'
payload="$(jq --null-input --compact-output --monochrome-output \
--arg title "$MSG_TITLE" \
--arg link "$MSG_LINK" \
--arg color "$MSG_COLOR" \
--arg message "$MSG_VALUE" \
'{
username: "Toltec",
avatar_url: "https://avatars0.githubusercontent.com/u/71158884",
embeds: [{
title: $title,
url: $link,
color: $color,
description: $message,
}]
}')"
curl --silent --show-error --fail \
--header "Content-Type: application/json" \
--data "$payload" \
'https://discord.com/api/webhooks/${{ inputs.channel }}/${{ inputs.token }}'
170 changes: 85 additions & 85 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
name: Setup Toltec dependencies
runs:
using: "composite"
steps:
- name: Check for Apt updates
shell: bash
run: |
sudo apt-get update -yq
echo "aptVersion=libarchive-tools-$(apt-cache policy libarchive-tools | grep -oP '(?<=Candidate:\s)(.+)')" >> $GITHUB_ENV
- name: Cache Apt packages
uses: actions/cache@v4
id: cache-apt
with:
path: ~/.aptcache
key: ${{ env.aptVersion }}
- name: Install or restore Apt packages
shell: bash
env:
CACHE_HIT: ${{ steps.cache-apt.outputs.cache-hit }}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
sudo apt-get install -yq libarchive-tools
mkdir -p ~/.aptcache
sudo dpkg -L libarchive-tools | while IFS= read -r f; do if test -f $f; then echo $f; fi; done | xargs cp --parents --target-directory ~/.aptcache/
else
sudo cp --verbose --force --recursive ~/.aptcache/* /
fi
- name: Cache shfmt
uses: actions/cache@v4
with:
path: /usr/local/bin/shfmt
key: 43439b996942b53dfafa9b6ff084f394555d049c98fb7ec37978f7668b43e1be
- name: Install shfmt
shell: bash
run: |
install_dir=/usr/local/bin
if ! [[ -f "$install_dir"/shfmt ]]; then
shfmt_version=v3.2.1
shfmt_checksum=43439b996942b53dfafa9b6ff084f394555d049c98fb7ec37978f7668b43e1be
sudo curl --location --silent --fail --tlsv1.2 --proto '=https' \
--output "$install_dir"/shfmt \
https://github.com/mvdan/sh/releases/download/"$shfmt_version"/shfmt_"$shfmt_version"_linux_amd64
sha256sum -c <(echo "$shfmt_checksum $install_dir/shfmt") > /dev/null 2>&1
sudo chmod a+x "$install_dir"/shfmt
fi
- name: Cache Shellcheck
uses: actions/cache@v4
with:
path: /usr/local/bin/shellcheck
key: 64f17152d96d7ec261ad3086ed42d18232fcb65148b44571b564d688269d36c8
- name: Install Shellcheck
shell: bash
run: |
install_dir=/usr/local/bin
if ! [[ -f "$install_dir"/shellcheck ]];then
shellcheck_version=v0.7.1
shellcheck_checksum=64f17152d96d7ec261ad3086ed42d18232fcb65148b44571b564d688269d36c8
shellcheck_arname=shellcheck.tar.xz
curl --location --silent --fail --tlsv1.2 --proto '=https' \
--output "$shellcheck_arname" \
https://github.com/koalaman/shellcheck/releases/download/"$shellcheck_version"/shellcheck-"$shellcheck_version".linux.x86_64.tar.xz
sha256sum -c <(echo "$shellcheck_checksum $shellcheck_arname") > /dev/null 2>&1
tar -xf "$shellcheck_arname" --strip-components=1 \
shellcheck-"$shellcheck_version"/shellcheck
rm "$shellcheck_arname"
chmod a+x shellcheck
sudo chown root:root shellcheck
sudo mv shellcheck "$install_dir"
fi
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache Python environment
uses: actions/cache@v4
id: cache-python
with:
path: .venv
key: .venv-${{ hashFiles('requirements.txt') }}
- name: Install Python dependencies
shell: bash
env:
CACHE_HIT: ${{ steps.cache-python.outputs.cache-hit }}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
make .venv/bin/activate
fi
using: "composite"
steps:
- name: Check for Apt updates
shell: bash
run: |
sudo apt-get update -yq
echo "aptVersion=libarchive-tools-$(apt-cache policy libarchive-tools | grep -oP '(?<=Candidate:\s)(.+)')" >> $GITHUB_ENV
- name: Cache Apt packages
uses: actions/cache@v4
id: cache-apt
with:
path: ~/.aptcache
key: ${{ env.aptVersion }}
- name: Install or restore Apt packages
shell: bash
env:
CACHE_HIT: ${{ steps.cache-apt.outputs.cache-hit }}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
sudo apt-get install -yq libarchive-tools
mkdir -p ~/.aptcache
sudo dpkg -L libarchive-tools | while IFS= read -r f; do if test -f $f; then echo $f; fi; done | xargs cp --parents --target-directory ~/.aptcache/
else
sudo cp --verbose --force --recursive ~/.aptcache/* /
fi
- name: Cache shfmt
uses: actions/cache@v4
with:
path: /usr/local/bin/shfmt
key: 43439b996942b53dfafa9b6ff084f394555d049c98fb7ec37978f7668b43e1be
- name: Install shfmt
shell: bash
run: |
install_dir=/usr/local/bin
if ! [[ -f "$install_dir"/shfmt ]]; then
shfmt_version=v3.2.1
shfmt_checksum=43439b996942b53dfafa9b6ff084f394555d049c98fb7ec37978f7668b43e1be
sudo curl --location --silent --fail --tlsv1.2 --proto '=https' \
--output "$install_dir"/shfmt \
https://github.com/mvdan/sh/releases/download/"$shfmt_version"/shfmt_"$shfmt_version"_linux_amd64
sha256sum -c <(echo "$shfmt_checksum $install_dir/shfmt") > /dev/null 2>&1
sudo chmod a+x "$install_dir"/shfmt
fi
- name: Cache Shellcheck
uses: actions/cache@v4
with:
path: /usr/local/bin/shellcheck
key: 64f17152d96d7ec261ad3086ed42d18232fcb65148b44571b564d688269d36c8
- name: Install Shellcheck
shell: bash
run: |
install_dir=/usr/local/bin
if ! [[ -f "$install_dir"/shellcheck ]];then
shellcheck_version=v0.7.1
shellcheck_checksum=64f17152d96d7ec261ad3086ed42d18232fcb65148b44571b564d688269d36c8
shellcheck_arname=shellcheck.tar.xz
curl --location --silent --fail --tlsv1.2 --proto '=https' \
--output "$shellcheck_arname" \
https://github.com/koalaman/shellcheck/releases/download/"$shellcheck_version"/shellcheck-"$shellcheck_version".linux.x86_64.tar.xz
sha256sum -c <(echo "$shellcheck_checksum $shellcheck_arname") > /dev/null 2>&1
tar -xf "$shellcheck_arname" --strip-components=1 \
shellcheck-"$shellcheck_version"/shellcheck
rm "$shellcheck_arname"
chmod a+x shellcheck
sudo chown root:root shellcheck
sudo mv shellcheck "$install_dir"
fi
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache Python environment
uses: actions/cache@v4
id: cache-python
with:
path: .venv
key: .venv-${{ hashFiles('requirements.txt') }}
- name: Install Python dependencies
shell: bash
env:
CACHE_HIT: ${{ steps.cache-python.outputs.cache-hit }}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
make .venv/bin/activate
fi
20 changes: 10 additions & 10 deletions .github/actions/sync-repository/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ runs:
- name: rsync packages and index
shell: bash
run: |
mkdir -p private
chmod 700 private
echo '${{ inputs.ssh-key }}' > private/id_rsa
echo '${{ inputs.ssh-known-hosts }}' > private/known_hosts
chmod 600 private/*
rsync --archive --verbose --compress --delete --hard-links \
-e "ssh -p ${{ inputs.ssh-port }} -i private/id_rsa -o UserKnownHostsFile=private/known_hosts" \
'${{ inputs.local-path }}' \
'${{ inputs.remote-path }}'
rm -r private
mkdir -p private
chmod 700 private
echo '${{ inputs.ssh-key }}' > private/id_rsa
echo '${{ inputs.ssh-known-hosts }}' > private/known_hosts
chmod 600 private/*
rsync --archive --verbose --compress --delete --hard-links \
-e "ssh -p ${{ inputs.ssh-port }} -i private/id_rsa -o UserKnownHostsFile=private/known_hosts" \
'${{ inputs.local-path }}' \
'${{ inputs.remote-path }}'
rm -r private
6 changes: 3 additions & 3 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
jobs:
check-labels:
name: Check that PRs against the stable branch are labelled correctly
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Check labels
run: |
[[ '${{ github.base_ref }}' != stable ]] \
|| [[ '${{ contains(github.event.pull_request.labels.*.name, 'merge') }}' == true ]]
[[ '${{ github.base_ref }}' != stable ]] \
|| [[ '${{ contains(github.event.pull_request.labels.*.name, 'merge') }}' == true ]]
83 changes: 41 additions & 42 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
name: pr
on:
pull_request
on: pull_request
jobs:
lint:
name: Check that it conforms to the style guide
runs-on: ubuntu-22.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Toltec dependencies
uses: ./.github/actions/setup
- name: Check formatting
run: make format
- name: Check for erroneous constructs
run: make lint
pr:
name: Check that it builds without error
runs-on: ubuntu-22.04
needs: lint
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Toltec dependencies
uses: ./.github/actions/setup
- name: Build packages
run: FLAGS='--remote-repo https://toltec-dev.org/${{ github.base_ref }}' make repo-new
- name: Save the build output
uses: actions/upload-artifact@v4
with:
name: repo
path: build/repo
- name: Build packages for experimental
if: ${{ contains(github.event.pull_request.labels.*.name, 'experimental') }}
run: make repo FLAGS='--remote-repo https://toltec-dev.org/${{ github.base_ref }}'
- name: Sync packages with the remote repository
if: ${{ contains(github.event.pull_request.labels.*.name, 'experimental') }}
uses: ./.github/actions/sync-repository
with:
local-path: build/repo/
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
ssh-port: ${{ secrets.SSH_PORT }}
remote-path: ${{ secrets.REMOTE_SSH }}:/srv/toltec/experimental
lint:
name: Check that it conforms to the style guide
runs-on: ubuntu-24.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Toltec dependencies
uses: ./.github/actions/setup
- name: Check formatting
run: make format
- name: Check for erroneous constructs
run: make lint
pr:
name: Check that it builds without error
runs-on: ubuntu-24.04
needs: lint
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Toltec dependencies
uses: ./.github/actions/setup
- name: Build packages
run: FLAGS='--remote-repo https://toltec-dev.org/${{ github.base_ref }}' make repo-new
- name: Save the build output
uses: actions/upload-artifact@v4
with:
name: repo
path: build/repo
- name: Build packages for experimental
if: ${{ contains(github.event.pull_request.labels.*.name, 'experimental') }}
run: make repo FLAGS='--remote-repo https://toltec-dev.org/${{ github.base_ref }}'
- name: Sync packages with the remote repository
if: ${{ contains(github.event.pull_request.labels.*.name, 'experimental') }}
uses: ./.github/actions/sync-repository
with:
local-path: build/repo/
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
ssh-port: ${{ secrets.SSH_PORT }}
remote-path: ${{ secrets.REMOTE_SSH }}:/srv/toltec/experimental
Loading