CI: Resolves #123: Add FlyCI Wingman #18
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
name: Joplin Continuous Integration | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
pre_job: | |
if: github.repository == 'kgantchev/joplin' | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5 | |
with: | |
concurrent_skipping: 'same_content_newer' | |
Main: | |
needs: pre_job | |
if: github.repository == 'kgantchev/joplin' && | |
(needs.pre_job.outputs.should_skip != 'true' || | |
startsWith(github.ref, 'refs/tags/server-v') || | |
startsWith(github.ref, 'refs/tags/v')) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-2019] | |
steps: | |
- name: Disable TCP/UDP offload on Windows | |
if: runner.os == 'Windows' | |
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6 | |
- name: Disable TCP/UDP offload on Linux | |
if: runner.os == 'Linux' | |
run: sudo ethtool -K eth0 tx off rx off | |
- name: Disable TCP/UDP offload on macOS | |
if: runner.os == 'macOS' | |
run: | | |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0 | |
sudo sysctl -w net.link.generic.system.hwcksum_rx=0 | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update || true | |
sudo apt-get install -y gettext libsecret-1-dev translate-toolkit rsync xvfb | |
- name: Install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install pango | |
- name: Install Docker Engine | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update || true | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io | |
- uses: actions/checkout@v4 | |
- uses: olegtarasov/[email protected] | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18.15.0' | |
cache: 'yarn' | |
- name: Install Yarn | |
run: corepack enable | |
- uses: docker/login-action@v3 | |
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/server-v') | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Run tests, build and publish Linux and macOS apps | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
env: | |
APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} | |
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CSC_KEY_PASSWORD }} | |
CSC_LINK: ${{ secrets.APPLE_CSC_LINK }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
IS_CONTINUOUS_INTEGRATION: 1 | |
BUILD_SEQUENCIAL: 1 | |
SERVER_REPOSITORY: joplin/server | |
SERVER_TAG_PREFIX: server | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
run: "${GITHUB_WORKSPACE}/.github/scripts/run_ci.sh" | |
- name: Build and publish Windows app | |
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/v') | |
env: | |
CSC_KEY_PASSWORD: ${{ secrets.WINDOWS_CSC_KEY_PASSWORD }} | |
CSC_LINK: ${{ secrets.WINDOWS_CSC_LINK }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
IS_CONTINUOUS_INTEGRATION: 1 | |
BUILD_SEQUENCIAL: 1 | |
run: | | |
yarn install && cd packages/app-desktop && yarn dist | |
- name: Build Windows app (no publishing) | |
if: runner.os == 'Windows' && !startsWith(github.ref, 'refs/tags/v') | |
env: | |
IS_CONTINUOUS_INTEGRATION: 1 | |
BUILD_SEQUENCIAL: 1 | |
SERVER_REPOSITORY: joplin/server | |
SERVER_TAG_PREFIX: server | |
run: | | |
yarn install && cd packages/app-desktop && yarn dist --publish=never | |
- name: Fix my build | |
uses: fly-ci/wingman-action@v1 | |
if: failure() | |
ServerDockerImage: | |
needs: pre_job | |
if: github.repository == 'kgantchev/joplin' && needs.pre_job.outputs.should_skip != 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Docker Engine | |
run: | | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update || true | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Install Yarn | |
run: corepack enable | |
- name: Build Docker Image | |
env: | |
BUILD_SEQUENCIAL: 1 | |
run: | | |
yarn install | |
yarn buildServerDocker --tag-name server-v0.0.0 --repository joplin/server | |
docker run joplin/server:0.0.0-beta node dist/app.js migrate list | |
- name: Check HTTP request | |
run: | | |
docker run -p 22300:22300 joplin/server:0.0.0-beta node dist/app.js --env dev & | |
sleep 30 | |
expected_status="HTTP/1.1 200 OK" | |
actual_status=$(curl -I -X GET http://localhost:22300/api/ping | head -n 1) | |
if [[ ! "$actual_status" =~ "$expected_status" ]]; then | |
echo 'Failed while checking the status code after request to /api/ping' | |
echo 'expected: ' $expected_status | |
echo 'actual: ' $actual_status | |
exit 1; | |
fi | |
expected_body='{"status":"ok","message":"Joplin Server is running"}' | |
actual_body=$(curl http://localhost:22300/api/ping) | |
if [[ "$actual_body" != "$expected_body" ]]; then | |
echo 'Failed while checking the body response after request to /api/ping' | |
exit 1; | |
fi | |
- name: Fix my build | |
uses: fly-ci/wingman-action@v1 | |
if: failure() |